Git Product home page Git Product logo

importdata's Introduction

说明

将csv xls等格式文件导入mysql

Usage: saveSql [-cxj] <dir> <db>

Options:
    -h,--help       显示帮助菜单
    -c              csv格式文件
    -x              excel格式文件
    -j              json格式文件

Example:
    python saveSql.py -c data s_company     将目录data下的csv格式文件存入表s_company中

注意

data目录放需要导入的文件,也可以在当前目录新建文件夹再将数据放入 config.py此文件配置数据库相关信息 导入的数据列名必须包含在mysql表对应的列名中,如下: 表中包含如下字段

列名 说明
Id 序号
company 公司名称
description 公司简介
contacts 联系人
email 邮箱
telephone 电话
fax 传真
website 网站主页
root_type 主分类
category 公司所在分类
country 国家
address 地址
years_in_business 公司成立年数
income 年收入
employee 公司员工
export 出口产品
export_market 出口市场
import 进口产品
import_market 进口市场
purchasing_agent 数据源地址

若想导入成功,对应的csv xls等文件的数据列名必须在被包含在以上列名中。

result.png

importdata's People

Contributors

howie6879 avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

importdata's Issues

运行报错 请问一下 这是什么原因呢?

Traceback (most recent call last):
File "saveSql.py", line 14, in
cli()
File "saveSql.py", line 7, in cli
kwargs = docopt(doc)
File "/usr/local/lib/python2.7/site-packages/docopt.py", line 558, in docopt
DocoptExit.usage = printable_usage(doc)
File "/usr/local/lib/python2.7/site-packages/docopt.py", line 466, in printable_usage
usage_split = re.split(r'([Uu][Ss][Aa][Gg][Ee]:)', doc)
File "/usr/local/Cellar/python/2.7.14_2/Frameworks/Python.framework/Versions/2.7/lib/python2.7/re.py", line 171, in split
return _compile(pattern, flags).split(string, maxsplit)
TypeError: expected string or buffer

我打印出 doc 是none 请问作者有遇到过这个问题么?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.