使用odo将数据迁移到SQL [英] Using odo to migrate data to SQL

查看:130
本文介绍了使用odo将数据迁移到SQL的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个3 GB的CSV大文件,我想使用Blaze来调查数据,选择我感兴趣的数据,最终目标是将该数据迁移到合适的计算后端例如SQlite,PostgresSQL等.我可以将这些数据导入Blaze并对其进行良好的处理,但这是我遇到麻烦的部分:

I have a large 3 GB CSV file, and I'd like to use Blaze to investigate the data, select down to the data I'm interesting in analyzing, with the eventual goal to migrate that data into a suitable computational backend such as SQlite, PostgresSQL etc. I can get that data into Blaze and work on it fine, but this is the part I'm having trouble with:

db = odo(bdata, 'sqlite:///report.db::report')`

我不确定如何正确创建一个用sqlite打开的数据库文件.

I'm not sure how to properly create a db file to open with sqlite.

推荐答案

您可以使用此处列出的说明直接从CSV转换为sqlite. http://odo.pydata.org/en/latest/perf.html?highlight=sqlite#csv-sqlite3-57m-31s 我认为您缺少此处警告的列名称: http://odo.pydata.org/en/latest/sql.html?highlight=sqlite

You can go directly from CSV to sqlite using the directions listed here. http://odo.pydata.org/en/latest/perf.html?highlight=sqlite#csv-sqlite3-57m-31s I think you are missing the column names as warned about here: http://odo.pydata.org/en/latest/sql.html?highlight=sqlite

dshape = discover(resource('report_2015.csv'))
t = odo('report_2015.csv', 'sqlite:///report.db::report', dshape=dshape)

这篇关于使用odo将数据迁移到SQL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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