Skip to main content

Kamalator

Konverter dua arah (Bidirectional) antara Raw SQL (Oracle & PostgreSQL) dan SQLAlchemy 2.0 ORM berbasis AST (sqlglot & Python ast) dengan pendekatan Clean Architecture.

Fitur Utama

  1. Raw SQL -> SQLAlchemy 2.0 ORM (oracle() & postgresql()):
    • Mendukung query pendek maupun query panjang (otomatis memecah CTE WITH dan Subquery menjadi variabel terpisah).
    • Menangani sintaks spesifik Oracle (TRUNC, SYSDATE, DECODE, NVL, ROWNUM, FROM DUAL) dan PostgreSQL (::type cast, ILIKE, DISTINCT ON, FILTER).
  2. SQLAlchemy 2.0 ORM -> Raw SQL (to_oracle() & to_postgresql()):
    • Menerima objek Select/ClauseElement SQLAlchemy langsung atau potongan kode string Python SQLAlchemy tanpa perlu mendefinisikan class Model terlebih dahulu.
    • Menyubstitusikan nilai dictionary params ({'id': 101}) ke dalam query dan merapikan format SQL (pretty=True).
  3. Output Minimalis:
    • Hanya menampilkan watermark versi beserta durasi eksekusi (kamalator v0.1 - 0.23ms) diikuti langsung oleh hasil query-nya.

Penggunaan Cepat

import kamalator

id = 101

# 1. Raw SQL -> SQLAlchemy 2.0 ORM
kamalator.oracle(
    "SELECT * from table_a where tgl = trunc(sysdate) and id = :id",
    {"id": id},
)

kamalator.postgresql(
    "SELECT * from table_a where tgl = current_date and id = :id",
    {"id": id},
)

# 2. SQLAlchemy 2.0 ORM -> Raw SQL
kamalator.to_oracle(
    """
    select(TableA)
    .where(
        TableA.tgl == func.trunc(func.sysdate()),
        TableA.id == bindparam("id"),
    )
    """,
    {"id": id},
)

kamalator.to_postgresql(
    """
    select(TableA)
    .where(
        TableA.tgl == func.current_date(),
        TableA.id == bindparam("id"),
    )
    """,
    {"id": id},
)

Metadata

Release files for kamalator 0.1.1

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

Source distribution (sdist)

Source distribution for kamalator 0.1.1
File Size Uploaded Provenance Actions
kamalator-0.1.1.tar.gz 29.7 kB Without provenance Details for kamalator-0.1.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for kamalator 0.1.1
File Interpreter ABI Platform Actions
kamalator-0.1.1-py3-none-any.whl Python 3 none any Details for kamalator-0.1.1-py3-none-any.whl

Total release size: 66.4 kB

Release files / kamalator-0.1.1.tar.gz

Download URL kamalator-0.1.1.tar.gz
Size 29.7 kB
Tags Source
SHA-256 checksum
How to use checksums
ba1c82ef5ee9a437f2341aa8d04896b7beb046f3e625ae2b54b3edd79cbefbe9
BLAKE2b-256 checksum
How to use checksums
8ecf9ad2ed1f50bb12a34400eff17fd3bd55d73e6015ddc7e1dd99fcedf00cb7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.7

Release files / kamalator-0.1.1-py3-none-any.whl

Download URL kamalator-0.1.1-py3-none-any.whl
Size 36.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
4c206cea4673c019530ac34690919ebc1c37d457a70234dc23f5efd8d1f739f8
BLAKE2b-256 checksum
How to use checksums
7c6eab03eb4b74f804a156fbe3c06f6b803a21c4a8ea4ec2f9b4b3ed20f4c24c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.7

Security for kamalator 0.1.1

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.

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files No provenance

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