Skip to content

Commit

Permalink
Fix test fixture containing reserved keyword(s) in sql statements
Browse files Browse the repository at this point in the history
  • Loading branch information
Nicoretti committed Nov 22, 2023
1 parent 6b7b9f2 commit b5b98ce
Showing 1 changed file with 23 additions and 4 deletions.
27 changes: 23 additions & 4 deletions test/integration/sqlalchemy/test_suite.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,8 @@
from inspect import cleandoc

import pytest
from sqlalchemy import (
create_engine,
testing,
)
from sqlalchemy import create_engine
from sqlalchemy.schema import DDL
from sqlalchemy.testing.suite import ComponentReflectionTest as _ComponentReflectionTest
from sqlalchemy.testing.suite import CompoundSelectTest as _CompoundSelectTest
from sqlalchemy.testing.suite import DifficultParametersTest as _DifficultParametersTest
Expand Down Expand Up @@ -41,6 +39,27 @@ def test_row_with_dupe_names(self, connection):


class HasTableTest(_HasTableTest):
@classmethod
def define_views(cls, metadata):
query = 'CREATE VIEW vv AS SELECT id, "data" FROM test_table'

event.listen(metadata, "after_create", DDL(query))
event.listen(metadata, "before_drop", DDL("DROP VIEW vv"))

if testing.requires.schemas.enabled:
query = (
'CREATE VIEW {}.vv AS SELECT id, "data" FROM {}.test_table_s'.format(
config.test_schema,
config.test_schema,
)
)
event.listen(metadata, "after_create", DDL(query))
event.listen(
metadata,
"before_drop",
DDL("DROP VIEW %s.vv" % (config.test_schema)),
)

RATIONALE = cleandoc(
"""
The Exasol dialect does not check against views for `has_table`, see also `Inspector.has_table()`.
Expand Down

0 comments on commit b5b98ce

Please sign in to comment.