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: supports_multivalues_insert dialect option was mispelled #278

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion sqlalchemy_bigquery/base.py
Expand Up @@ -643,7 +643,7 @@ class BigQueryDialect(DefaultDialect):
supports_pk_autoincrement = False
supports_default_values = False
supports_empty_insert = False
supports_multiline_insert = True
supports_multivalues_insert = True
supports_unicode_statements = True
supports_unicode_binds = True
supports_native_decimal = True
Expand Down
13 changes: 13 additions & 0 deletions tests/unit/test_sqlalchemy_bigquery.py
Expand Up @@ -13,6 +13,8 @@
import pytest
import sqlalchemy

from conftest import setup_table


@pytest.fixture
def mock_bigquery_client():
Expand Down Expand Up @@ -158,3 +160,14 @@ def test__remove_type_from_empty_in(inp, outp):

r = BigQueryExecutionContext._BigQueryExecutionContext__remove_type_from_empty_in
assert r(None, inp) == outp


def test_multi_value_insert(faux_conn, last_query):
table = setup_table(faux_conn, "t", sqlalchemy.Column("id", sqlalchemy.Integer))
faux_conn.execute(table.insert().values([dict(id=i) for i in range(3)]))

last_query(
"INSERT INTO `t` (`id`) VALUES"
" (%(id_m0:INT64)s), (%(id_m1:INT64)s), (%(id_m2:INT64)s)",
{"id_m0": 0, "id_m1": 1, "id_m2": 2},
)