Skip to main content

In-process semantic engine for SQL generation from .view.yml definitions

Project description

airlayer

An in-process semantic engine that compiles .view.yml definitions into dialect-specific SQL. Define your metrics once — dimensions, measures, filters, segments — and compile to Postgres, BigQuery, Snowflake, DuckDB, and 6 other dialects.

import airlayer

result = airlayer.compile(
    views_yaml=[open("views/orders.view.yml").read()],
    query_json='{"measures": ["orders.total_revenue"], "dimensions": ["orders.status"]}',
    dialect="postgres",
)
print(result["sql"])
print(result["columns"])

No database connection required. No server to deploy. The compiler runs in-process — pass in YAML definitions and a query, get back SQL, bind parameters, and column metadata.

Features

  • 10 SQL dialects: Postgres, BigQuery, Snowflake, DuckDB, MySQL, ClickHouse, Redshift, Databricks, SQLite, Domo
  • Automatic joins: Declare entities on views, and airlayer infers JOINs via BFS on the entity graph
  • 12 built-in motifs: contribution, rank, anomaly detection, YoY/MoM/WoW, trend, moving average, cumulative, and more
  • Custom motifs: Define reusable analytical patterns in .motif.yml files
  • Validation: Check .view.yml files for errors without compiling a query

API

airlayer.compile(views_yaml, query_json, dialect, ...)dict with sql, params, columns

airlayer.validate(views_yaml, ...)True or raises ValueError

See the full documentation for the query format, schema reference, and library usage guide.

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

airlayer-0.0.7.tar.gz (248.8 kB view details)

Uploaded Source

Built Distributions

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

airlayer-0.0.7-cp313-cp313-win_amd64.whl (883.8 kB view details)

Uploaded CPython 3.13Windows x86-64

airlayer-0.0.7-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.0 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.17+ x86-64

airlayer-0.0.7-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (1.0 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.17+ ARM64

airlayer-0.0.7-cp313-cp313-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl (1.8 MB view details)

Uploaded CPython 3.13macOS 10.12+ universal2 (ARM64, x86-64)macOS 10.12+ x86-64macOS 11.0+ ARM64

File details

Details for the file airlayer-0.0.7.tar.gz.

File metadata

  • Download URL: airlayer-0.0.7.tar.gz
  • Upload date:
  • Size: 248.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: maturin/1.12.6

File hashes

Hashes for airlayer-0.0.7.tar.gz
Algorithm Hash digest
SHA256 34b1eea4d82c2f05a78b2754522b52f1cf9eb4fd3c3b536a108f59f282870054
MD5 b4c2876683bf482bcaf65fcfd5e7a4c6
BLAKE2b-256 34913e6bb929ed161c54539a774ce3c0cc1f52b15e109fe3c8205c294b16d4df

See more details on using hashes here.

File details

Details for the file airlayer-0.0.7-cp313-cp313-win_amd64.whl.

File metadata

File hashes

Hashes for airlayer-0.0.7-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 077220e4bd069a95c754a092823e0e3e124f3bdd523a4a038842adbc8ca1fcbc
MD5 a59a1c8cc777c168ae059134690a159f
BLAKE2b-256 bdfe75dd2682c0b7a33e324a9f7a11a4447c1d915d1238ac3dabef95f45c3bcd

See more details on using hashes here.

File details

Details for the file airlayer-0.0.7-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for airlayer-0.0.7-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 1ffa9acf5a6f61da707ba004122ddafa983e578530cd1070eb4a2e96950f69d8
MD5 55c71237a1fa8abd9fa0bfefee719baf
BLAKE2b-256 76e0e5b957ace36dc0070872e763af509964e590f504d38f68195c7e3b7ed677

See more details on using hashes here.

File details

Details for the file airlayer-0.0.7-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for airlayer-0.0.7-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 c2f41910da430e74f1e2248d0ce665e4f0c179a9d869754417148c384c7f9136
MD5 1fb9b71606226b91d63f6ca27ad47a4a
BLAKE2b-256 28c4757408283e62aedc0411a42735428c4b7dd6cf045535a062bc5b2521a6c5

See more details on using hashes here.

File details

Details for the file airlayer-0.0.7-cp313-cp313-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl.

File metadata

File hashes

Hashes for airlayer-0.0.7-cp313-cp313-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl
Algorithm Hash digest
SHA256 e47083f017d45854e4e8988ce4095c076c3b55c93ba8f20de77107d9836aec6f
MD5 18dcbd1a1aa90954082bb4107e62eb73
BLAKE2b-256 b87331a1f5fc766ab1f143a58fbb0303fdea46f7d255388e8bc94ed3cfa858d1

See more details on using hashes here.

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