Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add duckdb.describe('foobar') -> DESCRIBE foobar #162

Open
wuputah opened this issue Sep 5, 2024 · 0 comments
Open

add duckdb.describe('foobar') -> DESCRIBE foobar #162

wuputah opened this issue Sep 5, 2024 · 0 comments
Labels
enhancement New feature or request
Milestone

Comments

@wuputah
Copy link
Collaborator

wuputah commented Sep 5, 2024

The shape of the result of a DESCRIBE call is constant, so hopefully we can avoid the AS ... syntax for this function.

Some example usage in DuckDB:

D create table foo (bar int, baz text);
D describe foo;
┌─────────────┬─────────────┬─────────┬─────────┬─────────┬─────────┐
│ column_name │ column_type │  null   │   key   │ default │  extra  │
│   varchar   │   varchar   │ varchar │ varchar │ varchar │ varchar │
├─────────────┼─────────────┼─────────┼─────────┼─────────┼─────────┤
│ bar         │ INTEGER     │ YES     │         │         │         │
│ baz         │ VARCHAR     │ YES     │         │         │         │
└─────────────┴─────────────┴─────────┴─────────┴─────────┴─────────┘
D describe select 1, 2, 3, * from foo;
┌─────────────┬─────────────┬─────────┬─────────┬─────────┬─────────┐
│ column_name │ column_type │  null   │   key   │ default │  extra  │
│   varchar   │   varchar   │ varchar │ varchar │ varchar │ varchar │
├─────────────┼─────────────┼─────────┼─────────┼─────────┼─────────┤
│ 1           │ INTEGER     │ YES     │         │         │         │
│ 2           │ INTEGER     │ YES     │         │         │         │
│ 3           │ INTEGER     │ YES     │         │         │         │
│ bar         │ INTEGER     │ YES     │         │         │         │
│ baz         │ VARCHAR     │ YES     │         │         │         │
└─────────────┴─────────────┴─────────┴─────────┴─────────┴─────────┘

There is additional usage with httpfs that would handy to support as well, but the syntax adds the keyword table and then the filename is quoted. Perhaps this should be a parameter like remote => true that indicates the parameter is a remote file.
https://duckdb.org/docs/guides/meta/describe.html#describing-remote-tables

This syntax does not work without adding the table keyword.

D describe 'https://datasets.clickhouse.com/hits_compatible/hits.parquet';
Parser Error: syntax error at or near "'https://datasets.clickhouse.com/hits_compatible/hits.parquet'"
LINE 1: describe 'https://datasets.clickhouse.com/hits_c...
                 ^
@wuputah wuputah added the enhancement New feature or request label Sep 5, 2024
@wuputah wuputah changed the title add duckdb.describe('foobar') -> DESCRIBE foobar; add duckdb.describe('foobar') -> DESCRIBE foobar Sep 5, 2024
@JelteF JelteF added this to the 0.2.0 milestone Sep 30, 2024
@JelteF JelteF modified the milestones: 0.2.0, 0.3.0 Dec 10, 2024
@JelteF JelteF modified the milestones: 0.3.0, 0.4.0 Dec 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants