Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update SQL query for split parameters function #358

Merged
merged 2 commits into from
Mar 12, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions mssql/functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -196,8 +196,8 @@ def mssql_split_parameter_list_as_sql(self, compiler, connection):
cursor.execute(f"CREATE TABLE #Temp_params (params {parameter_data_type} {Temp_table_collation})")
for offset in range(0, len(rhs_params), 1000):
sqls_params = rhs_params[offset: offset + 1000]
sqls_params = ", ".join("('{}')".format(item) for item in sqls_params)
cursor.execute("INSERT INTO #Temp_params VALUES %s" % sqls_params)
sql = "INSERT INTO [#Temp_params] ([params]) VALUES " + ', '.join(['(%s)'] * len(sqls_params))
cursor.execute(sql, sqls_params)

in_clause = lhs + ' IN ' + '(SELECT params from #Temp_params)'

Expand Down
Loading