Created
March 22, 2021 21:04
-
-
Save johnmastro/503c7b3356161fadcc5dae6a1805a895 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Make sure the table is created in the db even if it's empty. This is ugly, | |
# including in that every column will have type `string`, but the types will be | |
# fixed up as soon as there's actual data to load | |
if count == 0: | |
nulls_df = result_to_df([], field_info) | |
nulls_df = pd.concat( | |
[nulls_df, pd.DataFrame([{c: None for c in nulls_df.columns}])] | |
) | |
nulls_df.to_sql( | |
# ... | |
) | |
connection.execute(f"delete from identifier('{schema}.{temporary_table}') ") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment