Feature Request: Project DuckDB as ETL tool: Query metadata should be more precise, not NUMBER but INTEGER etc #38
Replies: 2 comments 1 reply
-
Huh. I've never used duckdb.description. Have you tried describe instead? That's what I usually use when trying to analyze this. c = duckdb.execute("""
create or replace table foo (col1 bigint, col2 integer, col3 varchar);
describe select * from foo""")
print(c.df().to_markdown())
Or, look at the data types of the result: c = duckdb.sql("""
create or replace table foo (col1 bigint, col2 integer, col3 varchar);
select * from foo;
""").arrow()
print(c.schema) col1: int64 |
Beta Was this translation helpful? Give feedback.
-
Hmm, while saying that, and reading the PEP again, I think I got confused by the vagueness and ambiguity of the spec? |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
When you execute
CREATE TABLE T2 as SELECT COL1, COL2 from T1 WITH NO DATA
, the target table has precise data types, e.g. if T1.COL1 is an integer, T2.COL1 will also be.When you execute the python code
The
columns
dict does not show INTEGER but a generic NUMBER. I would like to see the same data type as with the CTAS - selecting an INTEGER returns an INTEGER.I understand that this is not as simple as there can be formulas, it depends on the actual values etc. But for simple cases you can and I am simply asking to use the same logic as with the CTAS. If that means reading a couple of sample rows, so be it.
I am using DuckDB to implement a Data Integration tool.
https://github.com/rtdi/DuckTape
And here it hurts that I do not know the data types.
Beta Was this translation helpful? Give feedback.
All reactions