Csv2Sql image

CSV2SQL-UI is a Frontend app for CSV2SQL

Table of Contents

  1. What is Csv2sql-UI ?
  2. Using the browser based interface
    1. Running from source
  3. Supported data types
  4. Handling custom date/datetime formats
  5. Known issues, caveats and troubleshooting
  6. Future plans

Please have a quick look over the Known issues, caveats and troubleshooting section before using the app.

What is Csv2sql-UI?

Csv2sql-UI is a Frontend application for CSV2SQL, where csv2sql is a blazing fast fully automated tool to load huge CSV files into a RDBMS.

Csv2sql-UI can automatically...

Use csv2sql from your browser

For ease of use csv2sql has browser interface which can be used to easily configure the tool and also provides an interface that shows what is the progress of the various running tasks, which files are currently being processed, the current cpu and memory usage, etc.

browser interface demo

Running the app from source code

You must have elixir, node.js and mysql/postgresql installed in your system to run Csv2Sql.

To use the app just clone this repository

  1. cd assets and run npm install
  2. then install dependencies by mix deps.get

Finally, start the application by mix phx.server

This runs the phoenix server at localhost:4000 which provides a browser based interface to use the app.

Thats all !

Supported data types

Csv2sql currently supports MySql and PostgreSQL database.

Csv2Sql will map data in CSVs into one of the following data types:

Type mysql postgres
date For values matching pattern like YYYY-MM-DD or custom patterns NOT SUPPORTED, will map to VARCHAR
datetime For values matching pattern like YYYY-MM-DD hh:mm:ss or custom patterns , (WARNING: fractional seconds or timezone information will be lost if present) NOT SUPPORTED, will map to VARCHAR
boolean Maps values 0/1 or true/false to BIT type Maps values 0/1 or true/false to BOOLEAN type
integer INTINT
float DOUBLENUMERIC(1000, 100)
varchar VARCHAR VARCHAR
text TEXT TEXT

All other types of data, will map to either VARCHAR or TEXT.

Handling custom date/datetime formats

By default csv2sql will identify date or datetime of the following patterns YYYY-MM-DD and YYYY-MM-DD hh:mm:ss respectively. If a csv file contains date or datetime in some other format then they will be imported as varchar by default however by specifying custom patterns we can import such data of arbitrary formats as date or datetime.

csv2sql uses the Timex library to parse date/datetime. You can specify multiple custom patterns for date or datetime as a string having one or more patterns separated by ;

When using the Web UI for csv2sql enter these pattern strings in the config page under "Custom date patterns" or "Custom datetime patterns".

The patterns should be compatible with Timex directives specified here.

(Custom patterns are only supported when using the web ui and are not available in the cli version of the application)

Good to know/Caveats

Examples

To parse datetime like 11/14/2021 3:43:28 PM a pattern like {0M}/{0D}/{YYYY} {h12}:{m}:{s} {AM} can be specified

The custom pattern needed is like...

{0M}/{0D}/{YYYY} {h12}:{m}:{s} {AM}

Consider a CSV with date or datetime having multiple formats like...

Example Date Date Pattern Example Datetime Datetime Pattern
2021-11-14 {YYYY}-{0M}-{0D} 2021-11-14T15:43:28 {YYYY}-{0M}-{0D}T{0h24}:{m}:{s}
11-14-2021 {0M}-{0D}-{YYYY} 11-14-2021 15:43:28 {0M}-{0D}-{YYYY} {0h24}:{m}:{s}
11/14/2021 {0M}/{0D}/{YYYY} 11/14/2021 3:43:28 PM {0M}/{0D}/{YYYY} {h12}:{m}:{s} {AM}

The pattern strings to parse the above csv would look like...

For date {YYYY}-{0M}-{0D};{0M}-{0D}-{YYYY}

For datetime {YYYY}-{0M}-{0D}T{0h24}:{m}:{s};{0M}-{0D}-{YYYY} {0h24}:{m}:{s};{0M}/{0D}/{YYYY} {h12}:{m}:{s} {AM}

Known issues, caveats and troubleshooting:

Future