mirror of
https://github.com/csunny/DB-GPT.git
synced 2025-08-07 19:34:04 +00:00
add connector file
This commit is contained in:
parent
d746086694
commit
3ce31d5ea0
8
pilot/connections/base.py
Normal file
8
pilot/connections/base.py
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
|
# -*- coding:utf-8 -*-
|
||||||
|
|
||||||
|
"""We need to design a base class. That other connector can Write with this"""
|
||||||
|
|
||||||
|
class BaseConnection:
|
||||||
|
pass
|
||||||
|
|
7
pilot/connections/clickhouse.py
Normal file
7
pilot/connections/clickhouse.py
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
|
||||||
|
class ClickHouseConnector:
|
||||||
|
"""ClickHouseConnector"""
|
||||||
|
pass
|
7
pilot/connections/es.py
Normal file
7
pilot/connections/es.py
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
|
||||||
|
class ElasticSearchConnector:
|
||||||
|
"""ElasticSearchConnector"""
|
||||||
|
pass
|
6
pilot/connections/mongo.py
Normal file
6
pilot/connections/mongo.py
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
class MongoConnector:
|
||||||
|
"""MongoConnector is a class which connect to mongo and chat with LLM"""
|
||||||
|
pass
|
@ -4,7 +4,11 @@
|
|||||||
import pymysql
|
import pymysql
|
||||||
|
|
||||||
class MySQLOperator:
|
class MySQLOperator:
|
||||||
"""Connect MySQL Database fetch MetaData For LLM Prompt """
|
"""Connect MySQL Database fetch MetaData For LLM Prompt
|
||||||
|
Args:
|
||||||
|
|
||||||
|
Usage:
|
||||||
|
"""
|
||||||
|
|
||||||
default_db = ["information_schema", "performance_schema", "sys", "mysql"]
|
default_db = ["information_schema", "performance_schema", "sys", "mysql"]
|
||||||
def __init__(self, user, password, host="localhost", port=3306) -> None:
|
def __init__(self, user, password, host="localhost", port=3306) -> None:
|
||||||
@ -26,6 +30,9 @@ class MySQLOperator:
|
|||||||
cursor.execute(_sql)
|
cursor.execute(_sql)
|
||||||
results = cursor.fetchall()
|
results = cursor.fetchall()
|
||||||
return results
|
return results
|
||||||
|
|
||||||
|
def get_index(self, schema_name):
|
||||||
|
pass
|
||||||
|
|
||||||
def get_db_list(self):
|
def get_db_list(self):
|
||||||
with self.conn.cursor() as cursor:
|
with self.conn.cursor() as cursor:
|
||||||
@ -38,5 +45,7 @@ class MySQLOperator:
|
|||||||
dbs = [d["Database"] for d in results if d["Database"] not in self.default_db]
|
dbs = [d["Database"] for d in results if d["Database"] not in self.default_db]
|
||||||
return dbs
|
return dbs
|
||||||
|
|
||||||
|
def get_meta(self, schema_name):
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
6
pilot/connections/oracle.py
Normal file
6
pilot/connections/oracle.py
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
|
# -*- coding:utf-8 -*-
|
||||||
|
|
||||||
|
class OracleConnector:
|
||||||
|
"""OracleConnector"""
|
||||||
|
pass
|
@ -1,2 +0,0 @@
|
|||||||
#!/usr/bin/env python3
|
|
||||||
# -*- coding: utf-8 -*-
|
|
8
pilot/connections/postgres.py
Normal file
8
pilot/connections/postgres.py
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
class PostgresConnector:
|
||||||
|
"""PostgresConnector is a class which Connector to chat with LLM"""
|
||||||
|
pass
|
7
pilot/connections/redis.py
Normal file
7
pilot/connections/redis.py
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
|
# -*- coding:utf-8 -*-
|
||||||
|
|
||||||
|
|
||||||
|
class RedisConnector:
|
||||||
|
"""RedisConnector"""
|
||||||
|
pass
|
Loading…
Reference in New Issue
Block a user