Skip to main content

Load a csv file into a database

Project description

loadcsv is a programa and a library to load CSV files to databases and for converting CSV files to SQL inserrt or update statements.

The utility gets the names of the columns from the first row of the CSV file.

I wrote this utility because I was tired of doing always small scripts for doing this kind os loads.

By now the utility suport MySQL, PostgresSQL and sqlite, but can be used with other SQL databases using the utility to generate the SQL statements and sending them to the database:

Usage: loadcsv [options] filename.csv
If no database provided, display SQL to stdout

Options::
  -h, --help            show this help message and exit
  -D DRIVER, --driver=DRIVER
                        database driver mysql, pgsql, sqlite
  -H HOSTNAME, --hostname=HOSTNAME
                        database server hostname,defaults to localhost
  -d DBNAME, --dbname=DBNAME
                        database name (filename on sqlite)
  -u USER, --user=USER  database username
  -p PASSWORD, --password=PASSWORD
                        database password
  -P PORT, --port=PORT  database port
  -t TABLE, --table=TABLE
                        database table to load
  --test                run text, do no commit to the database
  --delimiter=DELIMITER
                        CSV file field delimiter, by default semi-colon

he project code and bugtracker is hosted on Bitbucket.

Install

Using pip:

pip install loadcsv

Os download and use setup

python setup.py install

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

loadcsv-0.5.tar.gz (4.8 kB view details)

Uploaded Source

File details

Details for the file loadcsv-0.5.tar.gz.

File metadata

  • Download URL: loadcsv-0.5.tar.gz
  • Upload date:
  • Size: 4.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for loadcsv-0.5.tar.gz
Algorithm Hash digest
SHA256 b944a6fefbefee53e2d48b41ab5dc0f6b34fe32629cf13a58d23413208aa87ba
MD5 42400c0d9d60f3ae91b364e9f9830761
BLAKE2b-256 ad2b52067eb252ae1ffefb41ceb0058bb92a3fdeb782ad7af7335432406c92a5

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page