Skip to main content

GitData

GitData gives you one set of commands for exploring files and databases. List what is inside a source with gitdata ls, then preview its data with gitdata scan.

Install

GitData supports Python 3.9 through 3.12.

python3 -m pip install gitdata-lib

Oracle support is optional:

python3 -m pip install 'gitdata-lib[oracle]'

Explore a data source

The same two commands work across CSV files, SQLite databases, MariaDB/MySQL databases, and Oracle databases:

gitdata ls <source>
gitdata scan <source>

Use -l for a detailed listing, -a to include system objects, and --limit to choose how many rows to preview.

CSV

List the columns in a CSV file:

gitdata ls examples/locations-headered.csv

Preview its rows:

gitdata scan --limit 10 examples/locations-headered.csv

SQLite

Start with the database file, then move into a table or column:

# List tables
gitdata ls examples/inspection.sqlite

# Show table details
gitdata ls -l examples/inspection.sqlite/customers

# Preview rows
gitdata scan --limit 5 examples/inspection.sqlite/customers

# Examine one column
gitdata scan --limit 5 examples/inspection.sqlite/customers.email

SQLite references follow this shape:

path/to/database.sqlite
path/to/database.sqlite/table
path/to/database.sqlite/table.column

MariaDB and MySQL

Keep passwords in environment variables instead of putting them in database references:

export GITDATA_DB_PASSWORD='your-password'

SERVER='mysql://user@db.example.com?password_env=GITDATA_DB_PASSWORD'
DATABASE='mysql://user@db.example.com/sales?password_env=GITDATA_DB_PASSWORD'
TABLE='mysql://user@db.example.com/sales.orders?password_env=GITDATA_DB_PASSWORD'

Explore the server, database, and table with the same commands:

# List databases
gitdata ls "$SERVER"

# List tables
gitdata ls "$DATABASE"

# Show columns and indexes
gitdata ls -l "$TABLE"

# Preview rows
gitdata scan --limit 10 "$TABLE"

MariaDB/MySQL references follow this shape:

mysql://user@host
mysql://user@host/database
mysql://user@host/database.table

If the username is omitted, GitData uses the current operating-system username. Use gitdata ls -a when you also want to see system databases or tables.

Try the included MariaDB example

The repository includes examples/mariadb.sql. Load it into a disposable MariaDB container:

docker run --name gitdata-example-mariadb \
  -e MARIADB_ROOT_PASSWORD=example \
  -p 3307:3306 \
  -d mariadb:10.7

until docker exec gitdata-example-mariadb \
  mariadb-admin ping -h 127.0.0.1 -uroot -pexample --silent
do
  sleep 1
done

docker exec -i gitdata-example-mariadb \
  mariadb -uroot -pexample < examples/mariadb.sql

export GITDATA_EXAMPLE_PASSWORD=example
gitdata ls 'mysql://root@127.0.0.1:3307/gitdata_example?password_env=GITDATA_EXAMPLE_PASSWORD'
gitdata scan --limit 5 'mysql://root@127.0.0.1:3307/gitdata_example.customers?password_env=GITDATA_EXAMPLE_PASSWORD'

Remove the example when finished:

docker rm -f gitdata-example-mariadb

Command reference

gitdata ls <source>          list databases, tables, or columns
gitdata ls -l <source>       show a detailed listing
gitdata ls -a <source>       include system objects
gitdata scan <source>        preview and profile data
gitdata scan --limit N ...   preview at most N rows

Run a command with --help for all options:

gitdata ls --help
gitdata scan --help

Oracle

Install the optional Oracle driver, then keep the password in an environment variable:

python3 -m pip install 'gitdata-lib[oracle]'
export ORACLE_PASSWORD='your-password'

DATABASE='oracle://app@db.example.com:1521/FREEPDB1?password_env=ORACLE_PASSWORD'
TABLE="${DATABASE}#orders"

Explore the service and its tables with the same commands:

# List tables owned by the connected user
gitdata ls "$DATABASE"

# Show table counts and sizes
gitdata ls -l "$DATABASE"

# Show column details
gitdata ls -l "$TABLE"

# Preview rows
gitdata scan --limit 10 "$TABLE"

Oracle references follow this shape:

oracle://user@host:port/service?password_env=ENVIRONMENT_VARIABLE
oracle://user@host:port/service?password_env=ENVIRONMENT_VARIABLE#table

Inline passwords are not accepted. Ordinary Oracle table and column names are shown in lowercase. Quoted identifiers are shown with their double quotes so names that differ only by Oracle quoting remain distinct; use the displayed spelling after # when selecting one (the quotes may be URL-encoded as %22).

Metadata

Release files for gitdata-lib 0.0.19

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for gitdata-lib 0.0.19
File Size Uploaded
gitdata_lib-0.0.19.tar.gz 67.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for gitdata-lib 0.0.19
File Interpreter ABI Platform
gitdata_lib-0.0.19-py3-none-any.whl Python 3 none any Details

Total release size: 145.8 kB

Release files / gitdata_lib-0.0.19.tar.gz

Download URL gitdata_lib-0.0.19.tar.gz
Size 67.5 kB
Tags Source
SHA-256 checksum
How to use checksums
420f9f477bf13f1c98844ba6af896097d784fda5831b04a4f6688ec1f958c479
BLAKE2b-256 checksum
How to use checksums
9e07edf265e9174082a4ca3168a184aabab7505b3d5fc0f0cc2a92b49f8aa355
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.14

Release files / gitdata_lib-0.0.19-py3-none-any.whl

Download URL gitdata_lib-0.0.19-py3-none-any.whl
Size 78.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d278da5920b26a6425da87d26bb1c880329012a555e64cfbf608a9751a628e23
BLAKE2b-256 checksum
How to use checksums
c2dabac86a233054404ac771306092fb5af13c0db18034e07a49e348b701f6f3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.14

Release history Release notifications | RSS feed

0.0.25

2 release files

0.0.24

2 release files

0.0.20

2 release files

This release

0.0.19 This release

2 release files

0.0.18

2 release files

0.0.17

2 release files

0.0.9

2 release files

0.0.8

2 release files

0.0.7

2 release files

0.0.6

2 release files

0.0.5

2 release files

0.0.4

2 release files

0.0.3

2 release files

0.0.1

2 release files

0.0.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page