add connector file

This commit is contained in:
csunny 2023-05-08 00:44:02 +08:00
parent d746086694
commit 3ce31d5ea0
9 changed files with 59 additions and 3 deletions

View 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

View File

@ -0,0 +1,7 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
class ClickHouseConnector:
"""ClickHouseConnector"""
pass

7
pilot/connections/es.py Normal file
View File

@ -0,0 +1,7 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
class ElasticSearchConnector:
"""ElasticSearchConnector"""
pass

View 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

View File

@ -4,7 +4,11 @@
import pymysql
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"]
def __init__(self, user, password, host="localhost", port=3306) -> None:
@ -26,6 +30,9 @@ class MySQLOperator:
cursor.execute(_sql)
results = cursor.fetchall()
return results
def get_index(self, schema_name):
pass
def get_db_list(self):
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]
return dbs
def get_meta(self, schema_name):
pass

View File

@ -0,0 +1,6 @@
#!/usr/bin/env python3
# -*- coding:utf-8 -*-
class OracleConnector:
"""OracleConnector"""
pass

View File

@ -1,2 +0,0 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

View 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

View File

@ -0,0 +1,7 @@
#!/usr/bin/env python3
# -*- coding:utf-8 -*-
class RedisConnector:
"""RedisConnector"""
pass