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.6.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.6.0-py3-none-any.whl (16.7 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: semql_introspect-0.6.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.6.0.tar.gz
Algorithm Hash digest
SHA256 d304612dc38b97bb322e59faeb660e02955a0530249f384f34ee00925fa22ead
MD5 bb53799a3edd042ce52cb1c203902bb4
BLAKE2b-256 30d90481dee5cd12f0aaca6131e7ad0529caf24ec48467c0e8a3092190a343e5

See more details on using hashes here.

Provenance

The following attestation bundles were made for semql_introspect-0.6.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.6.0-py3-none-any.whl.

File metadata

File hashes

Hashes for semql_introspect-0.6.0-py3-none-any.whl
Algorithm Hash digest
SHA256 1ddb2ed0e447ed42e03bbe8a55d5ba067e2db1d3924e836d9837e1c171ec4ce7
MD5 69de6b30e4537f60fc85b7248f4488fc
BLAKE2b-256 725c63871ba70a0f1671d95710bd6ab9331636cee6ab2fd2d4507e2da1f2aa5c

See more details on using hashes here.

Provenance

The following attestation bundles were made for semql_introspect-0.6.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