-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Improved schema and catalog support from SQL #1877
Comments
@houqp @jimexist FYI - so you have an idea where im trying to go...im trying to make datafusion-cli a really quick and powerful tool for doing ad hoc data analysis / query testing - and i think improved catalog & schema support will help with that. Through a combination of this, #1872, and im hoping to also eventually add an s3 feature (but i have plenty to work on before that) i hope to achieve that. I just wanted to give you both some additional color about my longer term objectives. Let me know if any concerns. |
I made a comment prematurely but I looked at code more and now I have some context.
As I said in my previous rant, a lot of times you don't need this...and it can add extra complexity for developers to maintain, and for users to keep track of. |
Fortunately, we already have the ability to parse table refs into catalog, schema, and table with Definitely agree on maintaining current active catalog / schema. From a pure sql / datafusion-cli perspective i was thinking of using the i believe postgres supports putting databases names, schemas, and tables in double quotes so i would think we could support something similar for resolving names with ".". In my current PR #1959 i thought i was actually quite close with adding |
In this example, it seemed like parsing the table refs wasn't working:
Then I saw a change in datafusion/src/catalog/mod.rs to split the table reference; assuming that fixes it. You said
I'm assuming we will still be able to use simple table names, right? |
ah yeah, i was referring to in my PR (#1959) which was leveraging on what looked like an incomplete feature for properly resolving catalog / schema / table. You can still query for single table names in the currently active catalog / schema - which right now is only 'datafusion' and 'public' - but i plan on adding a feature (such as psql \c to connect to database) to help with that. I made significant progress on the above referenced PR, just working on the ballista serialization now. Would be good to get another set of eyes on it if youre interested. Below is example from that PR.
|
I think this is now complete. Let's file additional tickets for follow on work DataFusion CLI v26.0.0
❯ create schema foo;
0 rows in set. Query took 0.019 seconds.
❯ create database bar;
0 rows in set. Query took 0.000 seconds. |
Is your feature request related to a problem or challenge? Please describe what you are trying to do.
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
(This section helps Arrow developers understand the context and why for this feature, in addition to the what)
Right now there is limited schema and catalog support in sql. You have to be using language bindings and register the catalog / schema to the
ExecutionContext
before being able to select. I would like to be able to create schemas and catalogs from sql, without language bindings, so that its easier to manage ddl and do data analysis just using datafusion-cli.Describe the solution you'd like
A clear and concise description of what you want to happen.
Support the following sql statements:
CREATE CATALOG abc
CREATE SCHEMA xyz
Parse catalog and schema from
CREATE TABLE abc.xyz.tbl
instead of creating table `Create Schema support
Create Catalog / Database support
/c
command on datafusion cli to set active db / catalogDescribe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.
Additional context
Add any other context or screenshots about the feature request here.
Postgres reference here
https://www.postgresql.org/docs/9.3/sql-createschema.html
The text was updated successfully, but these errors were encountered: