|
19 | 19 | from sqlalchemy import select |
20 | 20 | from sqlalchemy import String |
21 | 21 | from sqlalchemy import Table |
| 22 | +from sqlalchemy.exc import SAWarning |
22 | 23 | from sqlalchemy.schema import CreateTable |
23 | 24 | from sqlalchemy.sql import column |
24 | 25 | from sqlalchemy.sql import table |
@@ -194,18 +195,21 @@ def test_try_cast(dialect): |
194 | 195 |
|
195 | 196 |
|
196 | 197 | def test_catalogs_create_table_with_pk(dialect): |
197 | | - statement = CreateTable(table_with_pk) |
198 | | - query = statement.compile(dialect=dialect) |
199 | | - assert 'primary key' not in str(query).lower() |
| 198 | + with pytest.warns(SAWarning, match="Trino does not support PRIMARY KEY constraints. Constraint will be ignored."): |
| 199 | + statement = CreateTable(table_with_pk) |
| 200 | + query = statement.compile(dialect=dialect) |
| 201 | + assert 'primary key' not in str(query).lower() |
200 | 202 |
|
201 | 203 |
|
202 | 204 | def test_catalogs_create_table_with_fk(dialect): |
203 | | - statement = CreateTable(table_with_fk) |
204 | | - query = statement.compile(dialect=dialect) |
205 | | - assert 'foreign key' not in str(query).lower() |
| 205 | + with pytest.warns(SAWarning, match="Trino does not support FOREIGN KEY constraints. Constraint will be ignored."): |
| 206 | + statement = CreateTable(table_with_fk) |
| 207 | + query = statement.compile(dialect=dialect) |
| 208 | + assert 'foreign key' not in str(query).lower() |
206 | 209 |
|
207 | 210 |
|
208 | 211 | def test_catalogs_create_table_with_unique(dialect): |
209 | | - statement = CreateTable(table_with_unique) |
210 | | - query = statement.compile(dialect=dialect) |
211 | | - assert 'unique' not in str(query).lower() |
| 212 | + with pytest.warns(SAWarning, match="Trino does not support UNIQUE constraints. Constraint will be ignored."): |
| 213 | + statement = CreateTable(table_with_unique) |
| 214 | + query = statement.compile(dialect=dialect) |
| 215 | + assert 'unique' not in str(query).lower() |
0 commit comments