Skip to content

Commit

Permalink
Tests: Improve test case about verifying words to be quoted
Browse files Browse the repository at this point in the history
  • Loading branch information
amotl committed Jun 25, 2024
1 parent a5e749c commit 0d8dcf8
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions tests/compiler_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -433,9 +433,9 @@ class FooBar(Base):
self.assertIn("CrateDB does not support unique constraints, "
"they will be omitted when generating DDL statements.", str(w[-1].message))

def test_ddl_with_reserved_words(self):
def test_ddl_with_reserved_words_and_uppercase(self):
"""
Verify CrateDB's reserved words like `object` are quoted properly.
Verify CrateDB's reserved words and columns using uppercase characters are quoted properly.
"""

Base = declarative_base(metadata=self.metadata)
Expand All @@ -445,18 +445,20 @@ class FooBar(Base):

__tablename__ = "foobar"

index = sa.Column(sa.Integer, primary_key=True)
ID = sa.Column(sa.Integer, primary_key=True)
index = sa.Column(sa.Integer)
array = sa.Column(sa.String)
object = sa.Column(sa.String)

# Verify SQL DDL statement.
self.metadata.create_all(self.engine, tables=[FooBar.__table__], checkfirst=False)
self.assertEqual(self.executed_statement, dedent("""
CREATE TABLE testdrive.foobar (
\t"index" INT NOT NULL,
\t"ID" INT NOT NULL,
\t"index" INT,
\t"array" STRING,
\t"object" STRING,
\tPRIMARY KEY ("index")
\tPRIMARY KEY ("ID")
)
""")) # noqa: W291, W293

0 comments on commit 0d8dcf8

Please sign in to comment.