Skip to content

Commit c3a34dc

Browse files
committed
feat: db sql
1 parent 31436a7 commit c3a34dc

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

backend/apps/datasource/crud/datasource.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -292,10 +292,9 @@ def preview(session: SessionDep, current_user: CurrentUser, id: int, data: Table
292292
{where}
293293
LIMIT 100"""
294294
elif ds.type == "sqlServer":
295-
sql = f"""SELECT [{"], [".join(fields)}] FROM [{conf.dbSchema}].[{data.table.table_name}]
295+
sql = f"""SELECT TOP 100 [{"], [".join(fields)}] FROM [{conf.dbSchema}].[{data.table.table_name}]
296296
{where}
297-
ORDER BY [{fields[0]}]
298-
OFFSET 0 ROWS FETCH NEXT 100 ROWS ONLY"""
297+
"""
299298
elif ds.type == "pg" or ds.type == "excel":
300299
sql = f"""SELECT "{'", "'.join(fields)}" FROM "{conf.dbSchema}"."{data.table.table_name}"
301300
{where}

0 commit comments

Comments
 (0)