33from sqlalchemy import Row , RowMapping , text
44from sqlalchemy .ext .asyncio import AsyncSession
55
6+ from backend .common .enums import DataBaseType
67from backend .core .conf import settings
78
89
@@ -18,7 +19,7 @@ async def get_all_tables(db: AsyncSession, table_schema: str) -> Sequence[RowMap
1819 :param table_schema: 数据库 schema 名称
1920 :return:
2021 """
21- if settings . DATABASE_TYPE == 'mysql' :
22+ if DataBaseType . mysql == settings . DATABASE_TYPE :
2223 sql = """
2324 SELECT table_name AS table_name, table_comment AS table_comment
2425 FROM information_schema.tables
@@ -48,7 +49,7 @@ async def get_table(db: AsyncSession, table_name: str) -> Row[tuple]:
4849 :param table_name: 表名
4950 :return:
5051 """
51- if settings . DATABASE_TYPE == 'mysql' :
52+ if DataBaseType . mysql == settings . DATABASE_TYPE :
5253 sql = """
5354 SELECT table_name AS table_name, table_comment AS table_comment
5455 FROM information_schema.tables
@@ -79,7 +80,7 @@ async def get_all_columns(db: AsyncSession, table_schema: str, table_name: str)
7980 :param table_name: 表名
8081 :return:
8182 """
82- if settings . DATABASE_TYPE == 'mysql' :
83+ if DataBaseType . mysql == settings . DATABASE_TYPE :
8384 sql = """
8485 SELECT column_name AS column_name,
8586 CASE WHEN column_key = 'PRI' THEN 1 ELSE 0 END AS is_pk,
0 commit comments