Skip to content

Commit

Permalink
fix(uploads): respect db engine spec's supports_multivalues_insert va…
Browse files Browse the repository at this point in the history
…lue for file uploads & enable multi-insert for MSSQL (apache#30222)

Co-authored-by: Ville Brofeldt <[email protected]>
(cherry picked from commit f8a7753)
  • Loading branch information
sfirke authored and sadpandajoe committed Sep 12, 2024
1 parent d85fdf4 commit 889ab36
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
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

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

0 comments on commit 889ab36

Please sign in to comment.