Skip to main content

SQLAlchemy fields

Project description

SQLAlchemy Fields

Build Status Publish Status Coverage Package version Supported Python versions


Documentation: https://aminalaee.dev/sqlalchemy-fields

Source Code: https://github.com/aminalaee/sqlalchemy-fields


Table of Contents

Installation

pip install sqlalchemy-fields
pip install 'sqlalchemy-fields[full]'

Custom Types

  • EmailType
  • FileType
  • ImageType
  • IPAddressType
  • URLType
  • UUIDType
from sqlalchemy import Column, Integer, create_engine
from sqlalchemy.orm import Session, declarative_base
from sqlalchemy_fields.types import IPAddressType


Base = declarative_base()
engine = create_engine("sqlite:///example.db")


class Example(Base):
    __tablename__ = "example"

    id = Column(Integer, primary_key=True)
    ip = Column(IPAddressType)


example = Example(ip="127.0.0.1")
with Session(engine) as session:
    session.add(example)
    session.commit()
    print(example.ip)
"""
IPv4Address("127.0.0.1")
"""

Storages

  • FileSystemStorage
  • S3Storage

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

sqlalchemy_fields-0.5.0.tar.gz (8.1 kB view hashes)

Uploaded Source

Built Distribution

sqlalchemy_fields-0.5.0-py3-none-any.whl (11.9 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page