Python odo sql AssertionError: datashape must be record type received 0 * {...}

I am trying to import CSV into MySQL using odo, but I am getting datashape error.

I understand that datashape takes the format:

var * {
    column: type
    ... 
}

      

where var means a variable number of lines. I am getting the following error:

AssertionError: datashape must be Record type, got 0 * {
  tod: ?string,
  interval: ?string,
  iops: float64,
  mb_per_sec: float64
}

      

I'm not sure where this number of lines comes from. I tried to explicitly install datashape with dshape()

, but keep getting the same error.

Here's a stripped-down version of the code that recreates the error:

from odo import odo

odo('test.csv', mysql_database_uri)

      

I am running Ubuntu 16.04 and Python 3.6.1 using Conda.

Thanks for any input.

+3


source to share


2 answers


Try to replace

odo('test.csv', mysql_database_uri) 

      



from

odo(pandas.read_csv('test.csv') , mysql_database_uri)

      

0


source


I had this error required to specify a table



# error
odo('data.csv', 'postgresql://usr:pwd@ip/db')

# works
odo('data.csv', 'postgresql://usr:pwd@ip/db::table')

      

0


source







All Articles