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

Allow user to customize table schema while creating #532

Closed
9 tasks
utkarsharma2 opened this issue Jul 13, 2022 · 2 comments · Fixed by #538
Closed
9 tasks

Allow user to customize table schema while creating #532

utkarsharma2 opened this issue Jul 13, 2022 · 2 comments · Fixed by #538
Labels
feature New feature or request product/python-sdk Label describing products

Comments

@utkarsharma2
Copy link
Collaborator

utkarsharma2 commented Jul 13, 2022

Please describe the feature you'd like to see

We are not using Table's columns attribute when we create a table. Currently, we rely on load_file_to_table which internally uses pandas to auto-detect the schema while creating a table. There is no way where users can supply schema of their own.

Describe the solution you'd like

Table objects have field columns which is supposed to have column data if the user has passed in columns using this field we should create a table by using the database.create_table() method and instruct pandas/libs(Bigquery, Snowflake) to append to the table rather than creating a new one.

Acceptance Criteria

  • All checks and tests in the CI should pass
  • Unit tests (90% code coverage or more, once available)
  • Integration tests (if the feature relates to a new database or external service)
  • Example DAG
  • Docstrings in reStructuredText for each of methods, classes, functions and module-level attributes (including Example DAG on how it should be used)
  • Exception handling in case of errors
  • Logging (are we exposing useful information to the user? e.g. source and destination)
  • Improve the documentation (README, Sphinx, and any other relevant)
  • How to use Guide for the feature (example)
@tatiana
Copy link
Collaborator

tatiana commented Jul 13, 2022

@utkarsharma2 as we discussed, the BaseDatabase has a create_table method which already uses the table.columns, which are in SQLAlchemy format :)

So I believe it is just a matter of using that. What I think is missing in the BQ implementation of load_file is to use/support this feature - potentially both on native and on non-native implementations. I'm handling this for Snowflake ATM, and I asked Daniel to take care of the Postgres one.

@utkarsharma2 utkarsharma2 changed the title While ceating tables allow user to pass custom table schema Allow user to customize table schema while creating Jul 13, 2022
@kaxil kaxil added the product/python-sdk Label describing products label Oct 6, 2022
@sunank200
Copy link
Contributor

This is already implemented as discussed with @utkarsharma2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature or request product/python-sdk Label describing products
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants