-
Notifications
You must be signed in to change notification settings - Fork 151
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
mraba/underscore_column_id: use
_
as column identifier
- Loading branch information
1 parent
43c6b56
commit 6f4c15d
Showing
4 changed files
with
88 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
# | ||
# Copyright (c) 2012-2023 Snowflake Computing Inc. All rights reserved. | ||
|
||
from sqlalchemy import ( | ||
Column, | ||
Integer, | ||
MetaData, | ||
String, | ||
Table, | ||
create_engine, | ||
insert, | ||
select, | ||
) | ||
|
||
from snowflake.sqlalchemy import URL | ||
|
||
from .parameters import CONNECTION_PARAMETERS | ||
|
||
|
||
def test_insert_with_identifier(): | ||
metadata = MetaData() | ||
table = Table( | ||
"table_1745924", | ||
metadata, | ||
Column("ca", Integer), | ||
Column("cb", String), | ||
Column("_", String), | ||
) | ||
|
||
engine = create_engine(URL(**CONNECTION_PARAMETERS)) | ||
|
||
try: | ||
metadata.create_all(engine) | ||
|
||
with engine.connect() as connection: | ||
connection.execute(insert(table).values(ca=1, cb="test", _="test_")) | ||
connection.execute( | ||
insert(table).values({"ca": 2, "cb": "test", "_": "test_"}) | ||
) | ||
result = connection.execute(select(table)).fetchall() | ||
assert result == [ | ||
(1, "test", "test_"), | ||
(2, "test", "test_"), | ||
] | ||
finally: | ||
metadata.drop_all(engine) |