Skip to main content

a lightweight package to convert files between sql and csv

Project description

sql-to-csv-to-sql

A Simple Command Line Utility for converting SQL statements to CSV and vice versa.

Installation

pip install sqlcsvsql

Usage

usage: __main__.py [-h] [-f FILEPATH] [-t TABLE_NAME] [-o OUTPUT] [-m {single,multi}] [-s {y,n}]

optional arguments:
  -h, --help            show this help message and exit
  -f FILEPATH, --filepath FILEPATH
                        SQL or CSV file path
  -t TABLE_NAME, --table-name TABLE_NAME
                        Table name for csv file
  -o OUTPUT, --output OUTPUT
                        Output filepath. Must end with extension
  -m {single,multi}, --statement_mode {single,multi}
                        single or multiline DML to generate
  -s {y,n}, --surround {y,n}
                        surround values with single quote. For a CSV with columns A,B,C if only B column's values should be surrounded with quotes, then use ```--surround n,y,n```. By default, all values are
                        surrounded.

Convert SQL to CSV

python -m sqlcsvsql -f file.sql

the converted file will be saved in the same directory with file name file.sql.csv

Convert CSV to SQL

python -m sqlcsvsql -f file.csv -t example_table -m single

the converted file will be saved in the same directory with file name file.csv.sql

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

sqlcsvsql-0.0.2.tar.gz (18.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

sqlcsvsql-0.0.2-py3-none-any.whl (19.6 kB view details)

Uploaded Python 3

File details

Details for the file sqlcsvsql-0.0.2.tar.gz.

File metadata

  • Download URL: sqlcsvsql-0.0.2.tar.gz
  • Upload date:
  • Size: 18.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.6.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.1 CPython/3.9.5

File hashes

Hashes for sqlcsvsql-0.0.2.tar.gz
Algorithm Hash digest
SHA256 5a99d2e49768b7d061cc9bd317b533bc3f109f53cedac3b5fdb402878ce9b4d3
MD5 89dd0bc0028f05cef5ce0637b0a5b7d1
BLAKE2b-256 dd30f4019207288a3495a5e6b0dfe4e88f1dca49bce92cae0ff44b2f3b635c4b

See more details on using hashes here.

File details

Details for the file sqlcsvsql-0.0.2-py3-none-any.whl.

File metadata

  • Download URL: sqlcsvsql-0.0.2-py3-none-any.whl
  • Upload date:
  • Size: 19.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.6.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.1 CPython/3.9.5

File hashes

Hashes for sqlcsvsql-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 99f8d23da6d72ceefe9963e3bb2f870a28910319bdfa2ab21460bc2c6e710614
MD5 28c84646751200ea5cf6e99c067476ef
BLAKE2b-256 d4f346f5c7c817586207a1976c9d1a32a860708e7a153b87f2091883c9b802ec

See more details on using hashes here.

Supported by

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