Skip to main content

Summary

Converts SQLAlchemy models to AtlasGo HCL.

Quickstart

  • Run pip install sqlalchemy2atlas
  • Run sqlalchemy2atlas -h

Driver Support

  • PostgreSQL
    • 14.x
  • Cloud Spanner
  • MySQL
  • SQLLite

Example

Example of converting a SQLAlchemy module into AtlasGo HCL.

from datetime import datetime
from sqlalchemy.orm import declarative_base
from sqlalchemy import (
    Column,
    Integer,
    String,
    DateTime,
    CheckConstraint,
    ForeignKey,
)

Base = declarative_base()

class User(Base):
    __tablename__ = "user"

    # Feat: Primary Key
    id = Column(Integer, primary_key=True)

    # Feat: Column Types
    name = Column(String(30))
    full_name = Column(String)
    age = Column(Integer)

    # Feat: Check Constraints
    check_age_positive = CheckConstraint(age > 0)
    check_age_reasonable = CheckConstraint(age < 200)

class Account(Base):
    __tablename__ = "account"

    # Feat: Primary Key
    id = Column(Integer, primary_key=True)

    # Feat: Column Types, Foreign Keys
    user_id = Column(Integer, ForeignKey("user.id"), nullable=False)
    account_created_at = Column(DateTime, nullable=False)

Into

table "account" {
  schema = schema.public
  column "id" {
    null = false
    type = serial
  }
  column "user_id" {
    null = false
    type = integer
  }
  column "account_created_at" {
    null = false
    type = timestamp
  }
  primary_key {
    columns = [column.id]
  }
  foreign_key "account_user_id_fkey" {
    columns     = [column.user_id]
    ref_columns = [table.user.column.id]
    on_update   = NO_ACTION
    on_delete   = NO_ACTION
  }
}
table "user" {
  schema = schema.public
  column "id" {
    null = false
    type = serial
  }
  column "name" {
    null = true
    type = character_varying(30)
  }
  column "full_name" {
    null = true
    type = character_varying
  }
  column "age" {
    null = true
    type = integer
  }
  primary_key {
    columns = [column.id]
  }
  check "user_age_check" {
    expr = "(age > 0)"
  }
  check "user_age_check1" {
    expr = "(age < 200)"
  }
}
schema "public" {
}

Metadata

Release files for sqlalchemy2atlas 0.1.9

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

Source distribution (sdist)

Source distribution for sqlalchemy2atlas 0.1.9
File Size Uploaded Provenance
sqlalchemy2atlas-0.1.9.tar.gz 8.1 kB Without provenance Details

Built distribution (wheel)

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

Total release size: 17.0 kB

Release files / sqlalchemy2atlas-0.1.9.tar.gz

Download URL sqlalchemy2atlas-0.1.9.tar.gz
Size 8.1 kB
Tags Source
SHA-256 checksum
How to use checksums
a7834453eb2eee394dbf35a48b2c33151da2cb314dcb03842d3ee20ef79792e1
BLAKE2b-256 checksum
How to use checksums
4fbcc45c670cc42a67bd69faa363b3c0391bec299dd9c9e5891d81a8998e617d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.2.2 CPython/3.10.8 Linux/5.15.0-1023-azure

Release files / sqlalchemy2atlas-0.1.9-py3-none-any.whl

Download URL sqlalchemy2atlas-0.1.9-py3-none-any.whl
Size 8.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
2e33e1f22fd5201d9f6bd033cb7e8d7812dce1b6eb9ea3e745706c8baba92de4
BLAKE2b-256 checksum
How to use checksums
0d3f7e68cc2adb78079c4943fd3ab1ba973d8a8eb6ed8b58d1cc77054fc6b2e8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.2.2 CPython/3.10.8 Linux/5.15.0-1023-azure

Security for sqlalchemy2atlas 0.1.9

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.

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