crab-r
pip install uu-crab-r → import crab_r (Python ≥ 3.12, one abi3 wheel per
platform).
Generative technical metadata for BigQuery. Name a project, a dataset, a table, or hand over SQL; crab-r reads the catalog, the queries that produce each table (job history, view definitions, or your SQL), Dataplex lineage and the values themselves, then writes column and table descriptions that are checked against the data before they are trusted.
import crab_r
# A dataset, keeping state so an unchanged rerun costs nothing.
report = crab_r.describe("my-project.mart", store="state", budget_usd=1)
# One table and what it reads, one level up.
crab_r.describe("my-project.mart.orders", upstream=1, store="state")
# A query's result, described as a virtual table (checks run over the query).
crab_r.describe(sql="SELECT customer_id, COUNT(*) AS orders FROM orders GROUP BY 1",
default_dataset="my-project.mart")
# An OpenAI-compatible server instead of Vertex AI. The key is read from the
# environment variable named here, never passed as a value.
crab_r.describe("my-project.mart", openai_url="https://host/v1",
openai_model="gpt-4o", openai_key_env="OPENAI_API_KEY")
# Lookups read the store, no network.
print(crab_r.lookup("state", "my-project.mart.orders.status"))
print(crab_r.upstream("state", "my-project.mart.orders.status"))
# A TTL: drop the tables no describe or ingest has touched in 90 days.
crab_r.prune("state", 90) # {"tables": 3, "columns": 41, "regenerated": False}
A store that cannot be read
The store is a cache, so a damaged one (or one written in a format this build does not read) is regenerated rather than reported:
describe,ingest_lineageandprunerebuild it empty, log one warning on thecrab_rlogger, and return"regenerated": True.- The lookups (
table,lookup,upstream,downstream,due) never raise for it: they return one line startingregenerate_needed:that says nothing is recorded.crab_r.regenerate_needed(store)is the same check as a bool, without a lookup. - Only the store's own data files (
graph.base,graph.waland their temporaries) are deleted, never through a symbolic link (refused withCrabError); anything else in the directory is left alone. A store that is locked by another writer or mid-compaction is never touched.
Static lineage and BigQuery names
A deployment program's SQL lineage export (bq:// ids; contains,
derives_from and column_derives_from edges) can be written into a store
before any describe, so declared tables answer lookups offline:
export = ... # {"nodes": [...], "edges": [...]}, as the lineage export emits it
done = crab_r.ingest_lineage("state", export["nodes"], export["edges"])
# {"committed": True, "created": 14, "updated": 0, "edges": 20,
# "skipped": {"writes_to": 1, ...}, "rejected": []}
print(crab_r.upstream("state", "bq://proj/mart/orders_v#amt"))
print(crab_r.downstream("state", "proj.mart.orders")) # a table: what reads it
Ingest only adds: a description, type or edge the store holds is kept, and a
repeat ingest of the same export writes nothing. A later describe fills the
same nodes in and keeps what was declared. Entries crab-r does not model
(routines, writes_to, defined_by, ...) are counted in skipped; unusable
ones are listed in rejected by position, never repeated.
One BigQuery name has three spellings, and every function here accepts all of them:
| Spelling | Where it comes from |
|---|---|
bq://p/d/t#column (bq_id) |
the lineage export's own ids |
bq://p/d/t/column (bq_path) |
a store that keys by url and canonicalises urls the way graph-r's Python add() does, which drops the #fragment — there a column's # id would silently become its table. Key such a store with the path form |
p.d.t.column (dotted) |
the warehouse's own |
crab_r.bq_path("bq://proj/mart/orders#Status") # 'bq://proj/mart/orders/status'
crab_r.dotted("bq://proj/mart/orders/status") # 'proj.mart.orders.status'
crab-r's own store keys the exact sql://bigquery/p/d/t#column uri with no
url canonicalisation, so columns and tables stay distinct there. Column
names are lowercased (BigQuery treats them case-insensitively); a component
holding anything but letters, digits, _ and - (and : in a project) is
refused rather than guessed at.
Options are the crab-describe command's flags as keyword arguments
(lineage_location="us", profile=False, apply=True, ...). Credentials come
from Application Default Credentials; with openai_url= the model's key comes
from the variable openai_key_env= names (default OPENAI_API_KEY). Nothing
is written to the warehouse unless apply=True.
License: AGPL-3.0-or-later, or a commercial license from lituus-io.
Metadata
Release files for uu-crab-r 0.4.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| uu_crab_r-0.4.0.tar.gz | 968.5 kB | Without provenance | Details for uu_crab_r-0.4.0.tar.gz |
Built distributions (wheels)
| File | Actions Reset | |||
|---|---|---|---|---|
| uu_crab_r-0.4.0-cp312-abi3-win_amd64.whl | CPython 3.12 | abi3 | Windows x86-64 | Details for uu_crab_r-0.4.0-cp312-abi3-win_amd64.whl |
| uu_crab_r-0.4.0-cp312-abi3-manylinux_2_28_x86_64.whl | CPython 3.12 | abi3 | Linux glibc 2.28+ x86-64 | Details for uu_crab_r-0.4.0-cp312-abi3-manylinux_2_28_x86_64.whl |
| uu_crab_r-0.4.0-cp312-abi3-manylinux_2_28_aarch64.whl | CPython 3.12 | abi3 | Linux glibc 2.28+ ARM64 | Details for uu_crab_r-0.4.0-cp312-abi3-manylinux_2_28_aarch64.whl |
| uu_crab_r-0.4.0-cp312-abi3-macosx_11_0_arm64.whl | CPython 3.12 | abi3 | macOS 11.0+ ARM64 | Details for uu_crab_r-0.4.0-cp312-abi3-macosx_11_0_arm64.whl |
| uu_crab_r-0.4.0-cp312-abi3-macosx_10_12_x86_64.whl | CPython 3.12 | abi3 | macOS 10.12+ x86-64 | Details for uu_crab_r-0.4.0-cp312-abi3-macosx_10_12_x86_64.whl |
Total release size: 16.2 MB
Release files / uu_crab_r-0.4.0.tar.gz
| Download URL | uu_crab_r-0.4.0.tar.gz |
|---|---|
| Size | 968.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
3ae27826b7a340e53f68958b9a9ce52c348b6f29d747035615cce0611724bbdc
|
|
BLAKE2b-256 checksum How to use checksums |
77abcd3ec8ba40431a061b5f9b473168249dac222556ff3707bd172569edbcd6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.3
|
Release files / uu_crab_r-0.4.0-cp312-abi3-win_amd64.whl
| Download URL | uu_crab_r-0.4.0-cp312-abi3-win_amd64.whl |
|---|---|
| Size | 3.2 MB |
| Tags | CPython 3.12 Windows x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
fe6a11afad31e68c1d7f10f474bd060a485e0b3168ce1e2deaf604f10f0c0310
|
|
BLAKE2b-256 checksum How to use checksums |
82f6d6b8baddca7947a60ff4a9904ab1ec6d375276dffd282e6d9b0ae50feac9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.3
|
Release files / uu_crab_r-0.4.0-cp312-abi3-manylinux_2_28_x86_64.whl
| Download URL | uu_crab_r-0.4.0-cp312-abi3-manylinux_2_28_x86_64.whl |
|---|---|
| Size | 3.2 MB |
| Tags | CPython 3.12 Linux glibc 2.28+ x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
88b60171b8e3de7ae74d9282f735b64ee7ca091cd7e1f3374e7fb80759a25c06
|
|
BLAKE2b-256 checksum How to use checksums |
1af02cde8de07559b411ef6309fac1c1f16ebfba6c37cf7ff422cb8169e92d70
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.3
|
Release files / uu_crab_r-0.4.0-cp312-abi3-manylinux_2_28_aarch64.whl
| Download URL | uu_crab_r-0.4.0-cp312-abi3-manylinux_2_28_aarch64.whl |
|---|---|
| Size | 3.0 MB |
| Tags | CPython 3.12 Linux glibc 2.28+ ARM64 abi3 |
|
SHA-256 checksum How to use checksums |
0f41857bec74b7faaea1014441b0ab5a7149ff0bc68b5b4685af5b579149f1c7
|
|
BLAKE2b-256 checksum How to use checksums |
b7a132e5b13ea1ee5464a2ac5075f4a34f4fe9c9ca7ad9e55089c4558d7aca17
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.3
|
Release files / uu_crab_r-0.4.0-cp312-abi3-macosx_11_0_arm64.whl
| Download URL | uu_crab_r-0.4.0-cp312-abi3-macosx_11_0_arm64.whl |
|---|---|
| Size | 2.9 MB |
| Tags | CPython 3.12 abi3 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
be7da62151bff0f518db8d1d4fe0098165fab7f2580d2978e78f379a3622d5ec
|
|
BLAKE2b-256 checksum How to use checksums |
bf45ec7fa01872c02e287616398323a119da8c20a207cdbbd17d5ef7bf471e6d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.3
|
Release files / uu_crab_r-0.4.0-cp312-abi3-macosx_10_12_x86_64.whl
| Download URL | uu_crab_r-0.4.0-cp312-abi3-macosx_10_12_x86_64.whl |
|---|---|
| Size | 3.0 MB |
| Tags | CPython 3.12 abi3 macOS 10.12+ x86-64 |
|
SHA-256 checksum How to use checksums |
680b52c19d9da5fb2276e89fbaf478fa9ccd1c20106d8b9cc0875d264a46f0d2
|
|
BLAKE2b-256 checksum How to use checksums |
2e759604ad1e3ff0b5ed1cb6611dc1da58786a619c93d70d6f8eba570faf2aec
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.3
|
Security for uu-crab-r 0.4.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.