I'm trying to upload a list of lists as JSON using df.to_sql but it always upload with double quotes around it.
Desired output:
A header | Geometry |
---|---|
First | [[12.3, 45.6], [7.8, 9.1]] |
Second | [[12.3, 45.6], [7.8, 9.2]] |
Current output:
A header | Geometry |
---|---|
First | "[[12.3, 45.6], [7.8, 9.1]]" |
Second | "[[12.3, 45.6], [7.8, 9.2]]" |
Uploading snippet:
def upload_df(connection, df, table_name):
dtype = {
'Geometry':JSON
}
schema = "schema"
df.to_sql(table_name, connection,schema=schema,if_exists='replace',index=False, chunksize=1000, dtype=dtype)
Not sure if this is enough info to get help on this.
Thanks