Skip to main content

Easy storage handler

Project description

Ezstorge

[!CAUTION] Currently in development, not ready for use

A python ORM (Object-Relational Mapping) that allow to use a simple class syntax to interact with a database.

Why Ezstorge?

I needed to use a simple ORM to interact with a database, but I found that most of the existing ORMs are either too complex for a simple use case, and the migration tools are not always easy to setup and use.

  • Simple:

    • The type of the field is defined by the type hint
    • Has a simple query syntax similar to PonyORM
  • Flexible:

    • Automatic table creation
    • Automatic table update (add and remove fields)
    • No need to use extra migration tools
  • Beautiful:

    • Designed to be beautiful and easy to read.
    • Fully typed, for better IDE support

[!NOTE] Inspired by PonyORM and Sqlalchemy

Example

import pandas as pd
import ezstorge as ez

db = ez.Sqlite("example.db")

@db.useTable("cars")
class Car(ez.Table):
    model: str      # Required string field
    price: float    # Required float field
    miles: int = 0  # Default value if not provided

# Create, update, delete table
db.createTable(Car)
db.createTables()
db.updateTable(Car)
db.updateTables()
db.deleteTable(Car)
db.deleteTables()

car = Car(model="Tesla", price=100)
car.save()          # Save the car
db.commit()         # Commit the change

cars = Car.where() # Get all cars
print(cars)

# Use lambda to filter
cars = Car.where(lambda: Car.price > 20)
print(cars)

# Create a dataframe from the table
df = pd.DataFrame(users)
print(df)

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

ezstorages-0.0.10.tar.gz (9.9 kB view details)

Uploaded Source

Built Distribution

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

ezstorages-0.0.10-py3-none-any.whl (11.6 kB view details)

Uploaded Python 3

File details

Details for the file ezstorages-0.0.10.tar.gz.

File metadata

  • Download URL: ezstorages-0.0.10.tar.gz
  • Upload date:
  • Size: 9.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.8

File hashes

Hashes for ezstorages-0.0.10.tar.gz
Algorithm Hash digest
SHA256 e636839ad3ae62ec7c675bf5616ddc6c7b4339e9f713a136a1305b1a95c9e937
MD5 3bfe5db59218fdd698ab7058d0af2942
BLAKE2b-256 a51214c012f12b85f6c060a0e9bbbf070bd14386a703fd5a08cddc2707d461f4

See more details on using hashes here.

File details

Details for the file ezstorages-0.0.10-py3-none-any.whl.

File metadata

  • Download URL: ezstorages-0.0.10-py3-none-any.whl
  • Upload date:
  • Size: 11.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.8

File hashes

Hashes for ezstorages-0.0.10-py3-none-any.whl
Algorithm Hash digest
SHA256 a18f7c27324bad22a86d72328cc7e576405a9ee81594ac28fffbbddb1797974c
MD5 c94595a672ef3386989fa7a9b736a591
BLAKE2b-256 62561ebcaddb6de3a7c8e1bc4f09403cd43cd850f41d0206990c1911640eccd5

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