Command-line tool to extract and load SQL tables using a JSON Table Schema.
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
examples
the_el
.gitignore
LICENSE
README.md
logo.png
setup.py

README.md

the-el

Command-line tool to extract and load SQL tables using a JSON Table Schema. Wraps our fork of jsontableschema_sql and adds Carto support.

vector art of market-frankford line structure

Usage

# Extract a table to a CSV file
the_el read WASTE_BASKETS --db-schema GIS_STREETS --geometry-support sde-char --output-file waste_baskets.csv

# Generate a JSON Table Schema file from a table
the_el describe_table WASTE_BASKETS --db-schema GIS_STREETS --geometry-support sde-char --output-file schema.json

# Create a table using a JSON Table Schema file
the_el create_table waste_baskets_new schema.json --db-schema phl --geometry-support postgis

# Load a CSV file into a table
the_el write waste_baskets_new --db-schema phl --table-schema-path schema.json --geometry-support postgis --input-file waste_baskets.csv --skip-headers --truncate

# Swap 2 tables
the_el swap_table waste_baskets_new waste_baskets --db-schema phl

Note: Each command also requires a --connection-string parameter providing a connection string

Installation

pip install git+https://github.com/CityOfPhiladelphia/the-el.git#egg=the_el --process-dependency-links