feat: db sql

This commit is contained in:
junjun
2025-07-25 10:33:10 +08:00
parent 31436a71b0
commit c3a34dc569
+2 -3
View File
@@ -292,10 +292,9 @@ def preview(session: SessionDep, current_user: CurrentUser, id: int, data: Table
{where}
LIMIT 100"""
elif ds.type == "sqlServer":
sql = f"""SELECT [{"], [".join(fields)}] FROM [{conf.dbSchema}].[{data.table.table_name}]
sql = f"""SELECT TOP 100 [{"], [".join(fields)}] FROM [{conf.dbSchema}].[{data.table.table_name}]
{where}
ORDER BY [{fields[0]}]
OFFSET 0 ROWS FETCH NEXT 100 ROWS ONLY"""
"""
elif ds.type == "pg" or ds.type == "excel":
sql = f"""SELECT "{'", "'.join(fields)}" FROM "{conf.dbSchema}"."{data.table.table_name}"
{where}