Skip to content

Commit 0e627e5

Browse files
authored
Merge pull request #78 from aws-samples/spy_dev
add mysql schema
2 parents f4eb736 + 0b80b0e commit 0e627e5

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

application/nlq/data_access/database.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
import logging
2+
3+
import sqlalchemy
24
import sqlalchemy as db
35
from sqlalchemy import text, Column, inspect
46

@@ -55,6 +57,12 @@ def get_all_schema_names_by_connection(cls, connection: ConnectConfigEntity):
5557
engine = db.create_engine(db_url)
5658
inspector = inspect(engine)
5759
schemas = inspector.get_schema_names()
60+
elif connection.db_type == 'mysql':
61+
db_url = cls.get_db_url(connection.db_type, connection.db_user, connection.db_pwd, connection.db_host,
62+
connection.db_port, connection.db_name)
63+
engine = db.create_engine(db_url)
64+
database_connect = sqlalchemy.inspect(engine)
65+
schemas = database_connect.get_schema_names()
5866
return schemas
5967

6068
@classmethod

0 commit comments

Comments
 (0)