-
Notifications
You must be signed in to change notification settings - Fork 14.4k
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
feat(gsheets): file upload #24921
feat(gsheets): file upload #24921
Conversation
1d09b36
to
03a0102
Compare
Codecov Report
@@ Coverage Diff @@
## master #24921 +/- ##
==========================================
- Coverage 69.00% 67.26% -1.74%
==========================================
Files 1906 1906
Lines 74132 74183 +51
Branches 8208 8208
==========================================
- Hits 51153 49902 -1251
- Misses 20856 22158 +1302
Partials 2123 2123
Flags with carried forward coverage won't be shown. Click here to find out more.
... and 97 files with indirect coverage changes 📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
c1b020a
to
9472c76
Compare
@@ -57,7 +71,7 @@ class GSheetsParametersSchema(Schema): | |||
|
|||
class GSheetsParametersType(TypedDict): | |||
service_account_info: str | |||
catalog: Optional[dict[str, str]] | |||
catalog: dict[str, str] | None |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just curious why moving from Optional
? Because I see Optional
being used in several other TypedDict
classes. Want to confirm if this is a pattern we aim to follow moving forward, thanks.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We bumped the minimum Python version we support in Superset (I think to 3.9?), and in it we can use the syntax foo | None
instead of Optional[foo]
. This way we don't need to import Optional
, and the type declaration looks more natural (for example, it's similar to Typescript's foo | null
for an optional foo
).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh cool! Good to know moving forward then. Thanks @betodealmeida
SUMMARY
Add a
df_to_sql
method to the GSheets DB engine spec, so we can upload CSV files. When a file is uploaded, a new sheet is created, and the database catalog is updated to point the table name to the URL of the new sheet.The user can also choose to replace an existing table, in which case the sheet gets cleared before the data is inserted.
BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
Inserting some data:
Querying the table:
Uploading a different CSV and replacing the table:
And querying it (note that the metadata is cached and shows the old schema):
And the sheet after the second upload:
TESTING INSTRUCTIONS
ADDITIONAL INFORMATION