From e478a466fbaa91cb95c4e2cf9916906c5239cc09 Mon Sep 17 00:00:00 2001 From: Elliana May Date: Wed, 16 Nov 2022 11:18:03 +0800 Subject: [PATCH] test: add test for enum reflection --- duckdb_engine/tests/test_basic.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/duckdb_engine/tests/test_basic.py b/duckdb_engine/tests/test_basic.py index 56c78170..7d53d54d 100644 --- a/duckdb_engine/tests/test_basic.py +++ b/duckdb_engine/tests/test_basic.py @@ -234,6 +234,22 @@ def test_table_reflect(session: Session, engine: Engine) -> None: insp.reflecttable(user_table, None) +def test_enum_reflection(session: Session, engine: Engine) -> None: + importorskip("duckdb", "0.6.1-dev0") + + sql = [ + "CREATE TYPE enum_t AS ENUM('a', 'b');", + "CREATE TABLE tmp (enum_col enum_t);", + "INSERT INTO tmp VALUES ('b');", + "INSERT INTO tmp VALUES ('a');", + ] + for s in sql: + session.execute(text(s)) + + tmp = Table("tmp", MetaData()) + assert inspect(engine).reflecttable(tmp, include_columns=True) + + def test_fetch_df_chunks() -> None: import duckdb