Skip to main content

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.

Release files for semql-introspect 0.7.0

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

Source distribution (sdist)

Source distribution for semql-introspect 0.7.0
File Size Uploaded
semql_introspect-0.7.0.tar.gz 12.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for semql-introspect 0.7.0
File Interpreter ABI Platform
semql_introspect-0.7.0-py3-none-any.whl Python 3 none any Details

Total release size: 29.4 kB

Release files / semql_introspect-0.7.0.tar.gz

Download URL semql_introspect-0.7.0.tar.gz
Size 12.7 kB
Tags Source
SHA-256 checksum
How to use checksums
6e498c3c81c3aeb19a03eec29fcbb3bbf6abb0c2032e2c093c15c0a6aa7289b6
BLAKE2b-256 checksum
How to use checksums
6160314cade665e8c957fac0de70c808a195e73cfc8302bde055ebb521c41cfb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jul 21, 2026.

Transparency log

Release files / semql_introspect-0.7.0-py3-none-any.whl

Download URL semql_introspect-0.7.0-py3-none-any.whl
Size 16.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
def3c3bb5a6b6fc176e33e7a3194ef8766f1444f0d4bbcb5b636d9509ca518b6
BLAKE2b-256 checksum
How to use checksums
7bf7d6b9b215f54fd6ef0a70f65c722d2462d28c36eb635df65badaa3d57a217
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jul 21, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.7.0 This release

2 release files

0.6.0

2 release files

0.5.0

2 release files

0.4.0

2 release files

0.3.0

2 release files

0.2.1

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