蟒蛇odo sql AssertionError:datashape必须是记录类型,得到0 * {...} [英] python odo sql AssertionError: datashape must be Record type, got 0 * {...}

查看:121
本文介绍了蟒蛇odo sql AssertionError:datashape必须是记录类型,得到0 * {...}的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用odo将CSV导入MySQL,但出现数据形状错误.

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

我的理解是datashape采用以下格式:

My understanding is that datashape takes the format:

var * {
    column: type
    ... 
}

其中var表示行数可变.我收到以下错误:

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
}

我不确定0的行来自何处​​.我尝试使用dshape()显式设置datashape,但继续出现相同的错误.

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)

我正在使用Conda运行Ubuntu 16.04和Python 3.6.1.

I'm running Ubuntu 16.04 and Python 3.6.1 using Conda.

感谢您的任何输入.

推荐答案

我遇到了此错误,需要指定表

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')

这篇关于蟒蛇odo sql AssertionError:datashape必须是记录类型,得到0 * {...}的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆