Created
March 12, 2025 23:26
-
-
Save ben-nour/98e8dd1ebf262af88b0cc0f9ea75ac24 to your computer and use it in GitHub Desktop.
How to insert None objects into a Snowflake table's numeric column.
This file contains hidden or 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
import snowflake.connector | |
value = None | |
# Won't work: | |
f"""INSERT INTO example_table( | |
visitors | |
) VALUES | |
( | |
'{value}', | |
) | |
""" | |
# Works: | |
f"""INSERT INTO example_table( | |
visitors | |
) VALUES | |
( | |
TRY_TO_NUMBER('{value}'), | |
) | |
""" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment