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. GitData reads PASSWORD by default:
export PASSWORD='your-password'
SERVER='mysql://user@db.example.com'
DATABASE='mysql://user@db.example.com/sales'
TABLE='mysql://user@db.example.com/sales.orders'
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.
Inline passwords, query parameters, and fragment selectors are not accepted.
To use a password variable other than PASSWORD, set GITDATA_PASSWORD_ENV
to its name:
export GITDATA_PASSWORD_ENV=MYSQL_PASSWORD
export MYSQL_PASSWORD='your-password'
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_PASSWORD_ENV=GITDATA_EXAMPLE_PASSWORD
export GITDATA_EXAMPLE_PASSWORD=example
gitdata ls 'mysql://root@127.0.0.1:3307/gitdata_example'
gitdata scan --limit 5 'mysql://root@127.0.0.1:3307/gitdata_example.customers'
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 set the password. GitData reads
PASSWORD by default:
python3 -m pip install 'gitdata-lib[oracle]'
export PASSWORD='your-password'
CONNECTION='oracle://app@db.example.com/FREEPDB1'
SCHEMA="${CONNECTION}/APP"
TABLE="${SCHEMA}/orders"
Explore the service, visible schemas, and their tables with the same commands:
# List schemas containing tables visible to the connected user
gitdata ls "$CONNECTION"
# Show visible-schema table and estimated-row counts
gitdata ls -l "$CONNECTION"
# List tables visible in one schema
gitdata ls "$SCHEMA"
# Show table column and estimated-row counts; size may be unavailable
gitdata ls -l "$SCHEMA"
# Show column details
gitdata ls -l "$TABLE"
# Preview rows
gitdata scan --limit 10 "$TABLE"
Oracle service-name references follow these shapes; port 1521 may be omitted:
oracle://user@host
oracle://user@host:port/service
oracle://user@host:port/service/schema
oracle://user@host:port/service/schema/table
When the service is omitted, GitData first tries the username as the service
name. If Oracle does not advertise that service, GitData asks for an explicit
/service path.
Some Oracle installations expose a connection target by SID rather than by a
registered service name. Use the explicit oracle+sid scheme in that case:
oracle+sid://user@host/SID
oracle+sid://user@host:port/SID/schema
oracle+sid://user@host:port/SID/schema/table
Unlike a service-name reference, a SID reference always requires the /SID
path. GitData passes it to oracledb.makedsn(..., sid=...); it does not enable
Oracle Thick mode.
To use a password variable other than PASSWORD, set
GITDATA_PASSWORD_ENV to its name:
export GITDATA_PASSWORD_ENV=ORACLE_PASSWORD
export ORACLE_PASSWORD='your-password'
Inline passwords, query parameters, and fragment selectors are not accepted.
After connecting, GitData uses Oracle's permission-aware ALL_* dictionary
views: the connection root lists schemas containing tables visible to the user,
and a schema path lists its visible tables. Table references must include the
schema segment; the earlier /service/table shorthand is not supported.
Ordinary Oracle schema, 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 as the corresponding
path component (the quotes may be URL-encoded as %22).
Metadata
Release files for gitdata-lib 0.0.22
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| gitdata_lib-0.0.22.tar.gz | 69.7 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| gitdata_lib-0.0.22-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 149.6 kB
Release files / gitdata_lib-0.0.22.tar.gz
| Download URL | gitdata_lib-0.0.22.tar.gz |
|---|---|
| Size | 69.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
7c281469612ba1964c20b3003dcb3cef4d7b3ce89db64e26ac3f49556b87700c
|
|
BLAKE2b-256 checksum How to use checksums |
342c092c4b2df54256e07d36ea1f056dd04a0dd66a9e2cdc810c2ac92f8f8047
|
| 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.22-py3-none-any.whl
| Download URL | gitdata_lib-0.0.22-py3-none-any.whl |
|---|---|
| Size | 79.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
8bb0887328dc49f26082254c80cbb1ab7922b39c1e6b4a63f75113b277465e50
|
|
BLAKE2b-256 checksum How to use checksums |
16f3848530c7224960d15987a5a4853c6accc1c8b8ff6a44c9062564f7e55ea6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.14
|