Skip to main content

SQLAlchemy fields

Project description

SQLAlchemy Fields

PyPI - Version PyPI - Python Version


Table of Contents

Installation

pip install sqlalchemy-fields

Extra SQLAlchemy column types

  • Email
  • File
  • IP
  • URL
  • UUID
from sqlalchemy import Column, Integer, create_engine
from sqlalchemy.orm import Session, declarative_base
from sqlalchemy_fields.types import IPAddress

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

class Example(Base):
    __tablename__ = "example"

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


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")
"""

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.1.0.tar.gz (6.2 kB view hashes)

Uploaded Source

Built Distribution

sqlalchemy_fields-0.1.0-py3-none-any.whl (7.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