Skip to main content

Bootstrap a semql Catalog from a live database — emits Python cube stubs from Information Schema with heuristic measure/dimension inference.

Project description

semql-introspect

Bootstrap a semql Catalog from a live database.

Reads Information Schema, emits Python Cube stubs with heuristic measure / dimension / time-dimension inference and foreign-key derived joins. Designed for greenfield adoption — a team with 200 tables can generate the mechanical 80% of a catalog in seconds, then hand-edit the heuristic guesses.

Use this for cold-start scaffolding. For ongoing drift detection on a catalog you already have, see semql-validate-db — it probes a live database against an authored catalog and surfaces missing tables / columns / join predicates that the compiler can't see at build time.

Install

pip install semql-introspect

Usage

import duckdb
from semql.model import Dialect
from semql_introspect import introspect_to_python

con = duckdb.connect("warehouse.db")
print(introspect_to_python(con, dialect=Dialect.DUCKDB, schema="main"))

Or via CLI:

semql-introspect --backend duckdb --schema main --conn "warehouse.db"

Heuristics

  • Numeric columns named amount / price / revenue / cost / total / value / qty / quantity / countMeasure(agg="sum").
  • Columns ending in _idMeasure(agg="count_distinct") (the table's cardinality is usually interesting).
  • date / timestamp columns → TimeDimension.
  • Foreign keys → Join(relationship="many_to_one") plus the foreign-side Dimension(foreign_key=...).
  • Everything else → Dimension typed by the column's SQL type.

Heuristic guesses get a # TODO: review comment so the diff makes the inference choices reviewable.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

semql_introspect-0.7.0.tar.gz (12.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

semql_introspect-0.7.0-py3-none-any.whl (16.7 kB view details)

Uploaded Python 3

File details

Details for the file semql_introspect-0.7.0.tar.gz.

File metadata

  • Download URL: semql_introspect-0.7.0.tar.gz
  • Upload date:
  • Size: 12.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.14

File hashes

Hashes for semql_introspect-0.7.0.tar.gz
Algorithm Hash digest
SHA256 6e498c3c81c3aeb19a03eec29fcbb3bbf6abb0c2032e2c093c15c0a6aa7289b6
MD5 6b145e1f3ada2418405587eed45251d4
BLAKE2b-256 6160314cade665e8c957fac0de70c808a195e73cfc8302bde055ebb521c41cfb

See more details on using hashes here.

Provenance

The following attestation bundles were made for semql_introspect-0.7.0.tar.gz:

Publisher: release.yml on semql-io/semql

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file semql_introspect-0.7.0-py3-none-any.whl.

File metadata

File hashes

Hashes for semql_introspect-0.7.0-py3-none-any.whl
Algorithm Hash digest
SHA256 def3c3bb5a6b6fc176e33e7a3194ef8766f1444f0d4bbcb5b636d9509ca518b6
MD5 e4a6bdc5df7684905671410f91705a49
BLAKE2b-256 7bf7d6b9b215f54fd6ef0a70f65c722d2462d28c36eb635df65badaa3d57a217

See more details on using hashes here.

Provenance

The following attestation bundles were made for semql_introspect-0.7.0-py3-none-any.whl:

Publisher: release.yml on semql-io/semql

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page