Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

python odo sql AssertionError: datashape must be Record type, got 0 * {...}

I'm trying to import a CSV into MySQL using odo but am getting a datashape error.

My understanding is that datashape takes the format:

var * {
    column: type
    ... 
}

where var means a variable number of rows. I'm 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 that 0 number of rows is coming from. I've tried explicitly setting the datashape using dshape(), but continue to get 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'm running Ubuntu 16.04 and Python 3.6.1 using Conda.

Thanks for any input.

like image 446
jeff Avatar asked Nov 08 '22 20:11

jeff


1 Answers

I had this error, needed to specify table

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

# works
odo('data.csv', 'postgresql://usr:pwd@ip/db::table')
like image 131
citynorman Avatar answered Nov 15 '22 07:11

citynorman