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

fix(uploads): respect db engine spec's supports_multivalues_insert value for file uploads & enable multi-insert for MSSQL #30222

Merged
merged 9 commits into from
Sep 12, 2024
7 changes: 5 additions & 2 deletions superset/db_engine_specs/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -347,6 +347,7 @@ class BaseEngineSpec: # pylint: disable=too-many-public-methods
# Does database support join-free timeslot grouping
time_groupby_inline = False
limit_method = LimitMethod.FORCE_LIMIT
supports_multivalues_insert = False
allows_joins = True
allows_subqueries = True
allows_alias_in_select = True
Expand Down Expand Up @@ -1283,9 +1284,11 @@ def df_to_sql(
catalog=table.catalog,
schema=table.schema,
) as engine:
if engine.dialect.supports_multivalues_insert:
if (
engine.dialect.supports_multivalues_insert
or cls.supports_multivalues_insert
):
to_sql_kwargs["method"] = "multi"

df.to_sql(con=engine, **to_sql_kwargs)

@classmethod
Expand Down
1 change: 1 addition & 0 deletions superset/db_engine_specs/mssql.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ class MssqlEngineSpec(BaseEngineSpec):
max_column_name_length = 128
allows_cte_in_subquery = False
allow_limit_clause = False
supports_multivalues_insert = True
sfirke marked this conversation as resolved.
Show resolved Hide resolved

_time_grain_expressions = {
None: "{col}",
Expand Down
Loading