Skip to main content
Yanked

This release has been yanked by its maintainers, and will be ignored by installers, except when explicitly specified.
Consider using release 0.7.4 instead.
Reason given by maintainers: pydal 20261107 is too unstable

pydal2sql-core

PyPI - Version PyPI - Python Version
Code style: black License: MIT
su6 checks coverage.svg


Companion library for pydal2sql containing the actual logic. The other library only serves as a Typer-based CLI front-end.

More Documentation coming soon!

Table of Contents

Installation

pip install pydal2sql-core

As a Python Library

pydal2sql-core also exposes a generate_sql method that can perform the same actions on one (for CREATE) or two (for ALTER) pydal.Table objects when used within Python.

from pydal import DAL, Field
from pydal2sql_core import generate_sql

db = DAL(None, migrate=False)  # <- without running database or with a different type of database

person_initial = db.define_table(
    "person",
    Field(
        "name",
        "string",
        notnull=True,
    ),
    Field("age", "integer", default=18),
    Field("float", "decimal(2,3)"),
    Field("nicknames", "list:string"),
    Field("obj", "json"),
)

print(
    generate_sql(
        db.person, db_type="psql"  # or sqlite, or mysql; Optional with fallback to currently using database type.
    )
)
CREATE TABLE person
(
    id        INTEGER PRIMARY KEY AUTOINCREMENT,
    name      VARCHAR(512),
    age       INTEGER,
    float     NUMERIC(2, 3),
    nicknames TEXT,
    obj       TEXT
);
person_new = db.define_table(
    "person",
    Field(
        "name",
        "text",
    ),
    Field("birthday", "datetime"),
    redefine=True
)

generate_sql(
    person_initial,
    person_new,
    db_type="psql"
)
ALTER TABLE person
    ADD "name__tmp" TEXT;
UPDATE person
SET "name__tmp"=name;
ALTER TABLE person DROP COLUMN name;
ALTER TABLE person
    ADD name TEXT;
UPDATE person
SET name="name__tmp";
ALTER TABLE person DROP COLUMN "name__tmp";
ALTER TABLE person
    ADD birthday TIMESTAMP;
ALTER TABLE person DROP COLUMN age;
ALTER TABLE person DROP COLUMN float;
ALTER TABLE person DROP COLUMN nicknames;
ALTER TABLE person DROP COLUMN obj;

License

pydal2sql-core is distributed under the terms of the MIT license.

Metadata

Release files for pydal2sql-core 0.7.3

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

Source distribution (sdist)

Source distribution for pydal2sql-core 0.7.3
File Size Uploaded Provenance Actions
pydal2sql_core-0.7.3.tar.gz 24.5 kB Without provenance Details for pydal2sql_core-0.7.3.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for pydal2sql-core 0.7.3
File Interpreter ABI Platform Actions
pydal2sql_core-0.7.3-py3-none-any.whl Python 3 none any Details for pydal2sql_core-0.7.3-py3-none-any.whl

Total release size: 50.2 kB

Release files / pydal2sql_core-0.7.3.tar.gz

Download URL pydal2sql_core-0.7.3.tar.gz
Size 24.5 kB
Tags Source
SHA-256 checksum
How to use checksums
83c1df6b7e05d6f5d42c32150af6b480b96d89f79814b48126e73872ec35710f
BLAKE2b-256 checksum
How to use checksums
e283fc8c1a9e4ae96e086732a52392af44aa8407ae2c2993dbfe53b67b0e6009
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.11.7 {"installer":{"name":"uv","version":"0.11.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Linux Mint","version":"22.3","id":"zena","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release files / pydal2sql_core-0.7.3-py3-none-any.whl

Download URL pydal2sql_core-0.7.3-py3-none-any.whl
Size 25.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
9e1521f01d6f6f957b3299f868b63dc9a110c1b93f1ce8f754ddc242de5f4e2b
BLAKE2b-256 checksum
How to use checksums
531e8e19d94550711b9805f5adde16384cff44828eccab1cd99ade0ced4c4736
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.11.7 {"installer":{"name":"uv","version":"0.11.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Linux Mint","version":"22.3","id":"zena","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Security for pydal2sql-core 0.7.3

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