blaze / odo

Data Migration for the Blaze Project
http://odo.readthedocs.org/
BSD 3-Clause "New" or "Revised" License
1k stars 138 forks source link

How do I write a JSON column to a postgres table? #572

Open ganesh-krishnan opened 7 years ago

ganesh-krishnan commented 7 years ago

I'm trying to write a pandas dataframe that contains a JSON column into a postgres database using odo. Here is what I have:

from odo import odo odo(df, 'postgres://localhost:1234/testdb::test_table')

test_table has a JSON column called data. odo is unable to copy the dataframe and gives me 

*** NotImplementedError: No SQL-datashape match for type JSON.

I then tried to explicitly specify the JSON type for the column:

odo(df, 'postgres://localhost:1234/testdb::test_table',  
    dshape='var * {data: json}')  
*** TypeError: DataShape json is not NumPy-compatible

As you can see, it then gives me an error that DataShape json is not Numpy-compatible. How do I go about doing this with odo? Pandas to_sql works without a hitch, btw. The only problem is it's really slow.

ganesh-krishnan commented 7 years ago

Bump. Would appreciate some help! :)