List all the columns names and types for arrow connection #3623
Replies: 3 comments 6 replies
-
I think the information schema is what you are looking for! select * from information_schema.columns |
Beta Was this translation helpful? Give feedback.
-
Ah, you want to query the metadata of Arrow datasets - my mistake. One workaround might be to create a view on top of your dataset. Otherwise, DuckDB doesn't really track all of your current Python variables. So I think some kind of extra step would be needed. It may also be best to handle this with a Python loop. You can loop through your Python local variables and look for ones of type Arrow, etc. |
Beta Was this translation helpful? Give feedback.
-
Another suggestion, from a peek at the parquet file prospective, not sure if this will help but I've found it useful in detecting schema changes (clients sometimes make things interesting), the essence: select * from parquet_schema('*.parquet') as s; The resulting structure (pipe delimited result): From here it isn't difficult to work through the results. I found this useful as I can create an md5 for each "file_name" of the "name" field to detect different schemas, e.g.: select s.file_name, md5( string_agg( s.name ) ) from parquet_schema('*.parquet') as s group by s.file_name; -- All of the above via the CLI... just an old SQL dog -- |
Beta Was this translation helpful? Give feedback.
-
I have the following
This works in the sense I can query my database for example by
However, of course
db
is not a normal table.If I list the tables by
I got an empty list. Now, How can I print the analogous of the query
such that I can get name type of all columns in db?
Beta Was this translation helpful? Give feedback.
All reactions