|
31 | 31 | AthenaStruct, |
32 | 32 | AthenaTimestamp, |
33 | 33 | Tinyint, |
34 | | - get_double_type, |
35 | 34 | ) |
36 | 35 | from pyathena.util import RetryConfig |
37 | 36 | from tests.pyathena.conftest import ENV |
@@ -934,30 +933,13 @@ def test_reflect_table_with_schema(self, engine): |
934 | 933 | def test_reflect_table_include_columns(self, engine): |
935 | 934 | engine, conn = engine |
936 | 935 | one_row_complex = Table("one_row_complex", MetaData(schema=ENV.schema)) |
937 | | - version = float(re.search(r"^([\d]+\.[\d]+)\..+", sqlalchemy.__version__).group(1)) |
938 | | - if version <= 1.2: |
939 | | - engine.dialect.reflecttable( |
940 | | - conn, one_row_complex, include_columns=["col_int"], exclude_columns=[] |
941 | | - ) |
942 | | - elif version == 1.3: |
943 | | - # https://docs.sqlalchemy.org/en/13/changelog/changelog_13.html#change-64ac776996da1a5c3e3460b4c0f0b257 |
944 | | - engine.dialect.reflecttable( |
945 | | - conn, |
946 | | - one_row_complex, |
947 | | - include_columns=["col_int"], |
948 | | - exclude_columns=[], |
949 | | - resolve_fks=True, |
950 | | - ) |
951 | | - else: # version >= 1.4 |
952 | | - # https://docs.sqlalchemy.org/en/14/changelog/changelog_14.html#change-0215fae622c01f9409eb1ba2754f4792 |
953 | | - # https://docs.sqlalchemy.org/en/14/core/reflection.html#sqlalchemy.engine.reflection.Inspector.reflect_table |
954 | | - insp = sqlalchemy.inspect(engine) |
955 | | - insp.reflect_table( |
956 | | - one_row_complex, |
957 | | - include_columns=["col_int"], |
958 | | - exclude_columns=[], |
959 | | - resolve_fks=True, |
960 | | - ) |
| 936 | + insp = sqlalchemy.inspect(engine) |
| 937 | + insp.reflect_table( |
| 938 | + one_row_complex, |
| 939 | + include_columns=["col_int"], |
| 940 | + exclude_columns=[], |
| 941 | + resolve_fks=True, |
| 942 | + ) |
961 | 943 | assert len(one_row_complex.c) == 1 |
962 | 944 | assert one_row_complex.c.col_int is not None |
963 | 945 | pytest.raises(AttributeError, lambda: one_row_complex.c.col_tinyint) |
@@ -1357,7 +1339,7 @@ def test_reflect_select(self, engine): |
1357 | 1339 | assert isinstance(one_row_complex.c.col_int.type, types.INTEGER) |
1358 | 1340 | assert isinstance(one_row_complex.c.col_bigint.type, types.BIGINT) |
1359 | 1341 | assert isinstance(one_row_complex.c.col_float.type, types.FLOAT) |
1360 | | - assert isinstance(one_row_complex.c.col_double.type, get_double_type()) |
| 1342 | + assert isinstance(one_row_complex.c.col_double.type, types.DOUBLE) |
1361 | 1343 | assert isinstance(one_row_complex.c.col_string.type, types.String) |
1362 | 1344 | assert isinstance(one_row_complex.c.col_varchar.type, types.VARCHAR) |
1363 | 1345 | assert one_row_complex.c.col_varchar.type.length == 10 |
@@ -1408,7 +1390,7 @@ def test_get_column_type(self, engine): |
1408 | 1390 | assert isinstance(dialect._get_column_type("int"), types.INTEGER) |
1409 | 1391 | assert isinstance(dialect._get_column_type("bigint"), types.BIGINT) |
1410 | 1392 | assert isinstance(dialect._get_column_type("float"), types.FLOAT) |
1411 | | - assert isinstance(dialect._get_column_type("double"), get_double_type()) |
| 1393 | + assert isinstance(dialect._get_column_type("double"), types.DOUBLE) |
1412 | 1394 | assert isinstance(dialect._get_column_type("real"), types.FLOAT) |
1413 | 1395 | assert isinstance(dialect._get_column_type("string"), types.String) |
1414 | 1396 | assert isinstance(dialect._get_column_type("varchar"), types.VARCHAR) |
@@ -3265,9 +3247,7 @@ def test_numeric_type_variants(self, engine): |
3265 | 3247 | assert type(actual.c.col_integer2.type) in [types.INT, types.INTEGER, types.Integer] |
3266 | 3248 | assert type(actual.c.col_bigint.type) in [types.BIGINT, types.BigInteger] |
3267 | 3249 | assert type(actual.c.col_biginteger.type) in [types.BIGINT, types.BigInteger] |
3268 | | - expected_double_types = [types.FLOAT, types.Float] |
3269 | | - if hasattr(types, "DOUBLE"): |
3270 | | - expected_double_types.extend([types.DOUBLE, types.Double, types.DOUBLE_PRECISION]) |
| 3250 | + expected_double_types = [types.DOUBLE, types.Double, types.DOUBLE_PRECISION] |
3271 | 3251 | assert type(actual.c.col_double1.type) in expected_double_types |
3272 | 3252 | assert type(actual.c.col_double2.type) in expected_double_types |
3273 | 3253 | assert type(actual.c.col_double_precision.type) in expected_double_types |
|
0 commit comments