Skip to main content

zprp-23z-python-orm

Migration engine

Installation

pip install skibidi-orm

Usage

Implementation of schema.py

Primary functionallity of the migration engine is to allow for easy megrations between different versions of the database, so structure of schema file should be defined by proprioetary library using migration engine.

Hovewer we can define example schema file as follows for example purposes:

# schema.py
# ...

class Table(MigrationElement):

    def __init__(self) -> None:
        self.adapter = SQLite3Adapter()

        models = Table.__subclasses__()
        if self.__class__ == Table:
            for cls in models:
                self.adapter.create_table(cls.__dict__["table"])


class Post(Table):
    columns = [
        SQLite3Typing.Column(
            name="post_id",
            data_type="INTEGER",
            column_constraints=[c.PrimaryKeyConstraint("Post", "post_id")],
        ),
        SQLite3Typing.Column(
            name="post_name",
            data_type="TEXT",
            column_constraints=[c.NotNullConstraint("Post", "post_name")],
        ),
    ]

    table = SQLite3Typing.Table(name="Post", columns=columns)


SQLite3Config("test_database.db")

Above we defined simple implementation of Table class which works as a base model for all SQL tables in our databse.

Normally Table class would be abstracted away by proprietary library, but for the sake of example we defined it here.

When he have defined our schema all interactions of end-user with the migration engine are done through CLI.

skibidi-orm

CLI tool for managing schema creations and migrations in Skibidi ORM.

Usage:

$ skibidi-orm [OPTIONS] COMMAND [ARGS]...

Options:

  • -s, --schema-file PATH: Specify an external schema file path
  • --install-completion: Install completion for the current shell.
  • --show-completion: Show completion for the current shell, to copy it or customize the installation.
  • --help: Show this message and exit.

Commands:

  • go: Go back (and forward) to specific migration.
  • log: List all migration revisions with their...
  • migrate: Used to run migration for current schema...
  • preview-migration: Preview the migration that will be executed.
  • studio: Run web UI for CRUD operations on current DB.

skibidi-orm go

Go back (and forward) to specific migration.

Usage:

$ skibidi-orm go [OPTIONS] MIGRATION_ID

Arguments:

  • MIGRATION_ID: Migration ID [required]

Options:

  • --help: Show this message and exit.

skibidi-orm log

List all migration revisions with their descriptions and ID.

Usage:

$ skibidi-orm log [OPTIONS]

Options:

  • --help: Show this message and exit.

skibidi-orm migrate

Used to run migration for current schema file. Can accept an optional message as a description of the migration.

Usage:

$ skibidi-orm migrate [OPTIONS]

Options:

  • -m, --message TEXT: Description of migration
  • -d, --direct: Use --direct to run the migration directly. Without the flag, it will create a python migration file.
  • --help: Show this message and exit.

skibidi-orm preview-migration

Preview the migration that will be executed.

Usage:

$ skibidi-orm preview-migration [OPTIONS]

Options:

  • --help: Show this message and exit.

skibidi-orm studio

Run web UI for CRUD operations on current DB.

Usage:

$ skibidi-orm studio [OPTIONS]

Options:

  • -s, --schema-file TEXT: Schema file path
  • --help: Show this message and exit.

Metadata

Release files for SkiBiDi-ORM 0.1.35

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

Source distribution (sdist)

Source distribution for SkiBiDi-ORM 0.1.35
File Size Uploaded
skibidi_orm-0.1.35.tar.gz 731.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for SkiBiDi-ORM 0.1.35
File Interpreter ABI Platform
skibidi_orm-0.1.35-py3-none-any.whl Python 3 none any Details

Total release size: 1.5 MB

Release files / skibidi_orm-0.1.35.tar.gz

Download URL skibidi_orm-0.1.35.tar.gz
Size 731.2 kB
Tags Source
SHA-256 checksum
How to use checksums
5f2928ed8e112665539343b7db74362d73139473bf7556deea836bf2541694a0
BLAKE2b-256 checksum
How to use checksums
735bd477d30e583742bf8bb7adb6eabb671f8cd9b97f153b9ce53f9890f81d61
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via pdm/2.15.4 CPython/3.10.12 Linux/6.5.0-1021-azure

Release files / skibidi_orm-0.1.35-py3-none-any.whl

Download URL skibidi_orm-0.1.35-py3-none-any.whl
Size 754.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
3e90a1ce2a1e85fa3584f35fe470d1abf01c2e2644b6215e391af5b0544086a4
BLAKE2b-256 checksum
How to use checksums
93073b555d7728d5330c9a2fbdf99f8dcc7c506572dfc5d81d76803a71cc9809
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via pdm/2.15.4 CPython/3.10.12 Linux/6.5.0-1021-azure

Release history Release notifications | RSS feed

This release

0.1.35 This release

2 release files

0.1.21

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

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