Skip to content

Commit

Permalink
Resolved comments
Browse files Browse the repository at this point in the history
  • Loading branch information
ankiaga committed Nov 15, 2023
1 parent b81649a commit 8e53910
Showing 1 changed file with 33 additions and 10 deletions.
43 changes: 33 additions & 10 deletions tests/system/test_dbapi.py
Original file line number Diff line number Diff line change
Expand Up @@ -356,7 +356,7 @@ def test_ddl_execute_autocommit_true(shared_instance, dbapi_database):
SingerId INT64 NOT NULL,
Name STRING(1024),
) PRIMARY KEY (SingerId)
"""
"""
)
table = dbapi_database.table("DdlExecuteAutocommit")
assert table.exists() is True
Expand All @@ -379,7 +379,30 @@ def test_ddl_executemany_autocommit_true(shared_instance, dbapi_database):
SingerId INT64 NOT NULL,
Name STRING(1024),
) PRIMARY KEY (SingerId)
""",
""",
[],
)
table = dbapi_database.table("DdlExecuteManyAutocommit")
assert table.exists() is False

cur.close()
conn.close()


def test_ddl_executemany_autocommit_false(shared_instance, dbapi_database):
"""Check that DDL statement in non-autocommit mode results in exception for
executemany method ."""

conn = Connection(shared_instance, dbapi_database)
cur = conn.cursor()
with pytest.raises(ProgrammingError):
cur.executemany(
"""
CREATE TABLE DdlExecuteManyAutocommit (
SingerId INT64 NOT NULL,
Name STRING(1024),
) PRIMARY KEY (SingerId)
""",
[],
)
table = dbapi_database.table("DdlExecuteManyAutocommit")
Expand All @@ -405,16 +428,16 @@ def test_ddl_execute(shared_instance, dbapi_database):
SingerId INT64 NOT NULL,
Name STRING(1024),
) PRIMARY KEY (SingerId)
"""
"""
)
table = dbapi_database.table("DdlExecute")
assert table.exists() is False

cur.execute(
"""
INSERT INTO DdlExecute (SingerId, Name)
VALUES (1, "first-name")
"""
INSERT INTO DdlExecute (SingerId, Name)
VALUES (1, "first-name")
"""
)
assert table.exists() is True
conn.commit()
Expand Down Expand Up @@ -445,16 +468,16 @@ def test_ddl_executemany(shared_instance, dbapi_database):
SingerId INT64 NOT NULL,
Name STRING(1024),
) PRIMARY KEY (SingerId)
"""
"""
)
table = dbapi_database.table("DdlExecuteMany")
assert table.exists() is False

cur.executemany(
"""
INSERT INTO DdlExecuteMany (SingerId, Name)
VALUES (%s, %s)
""",
INSERT INTO DdlExecuteMany (SingerId, Name)
VALUES (%s, %s)
""",
[want_row],
)
assert table.exists() is True
Expand Down

0 comments on commit 8e53910

Please sign in to comment.