All Projects → spoqa → sqlalchemy-enum34

spoqa / sqlalchemy-enum34

Licence: MIT license
SQLAlchemy type to store standard enum.Enum values

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to sqlalchemy-enum34

bonobo-sqlalchemy
PREVIEW - SQL databases in Bonobo, using sqlalchemy
Stars: ✭ 23 (-51.06%)
Mutual labels:  sqlalchemy, databases
nim-gatabase
Connection-Pooling Compile-Time ORM for Nim
Stars: ✭ 103 (+119.15%)
Mutual labels:  sqlalchemy, databases
Awesome Sqlalchemy
A curated list of awesome tools for SQLAlchemy
Stars: ✭ 2,316 (+4827.66%)
Mutual labels:  sqlalchemy, databases
pydbantic
A single model for shaping, creating, accessing, storing data within a Database
Stars: ✭ 137 (+191.49%)
Mutual labels:  sqlalchemy, databases
Sqlalchemy Imageattach
SQLAlchemy extension for attaching images to entities.
Stars: ✭ 107 (+127.66%)
Mutual labels:  sqlalchemy, databases
Ormar
python async mini orm with fastapi in mind and pydantic validation
Stars: ✭ 155 (+229.79%)
Mutual labels:  sqlalchemy, databases
sqlalchemy-utc
SQLAlchemy type to store aware datetime values
Stars: ✭ 87 (+85.11%)
Mutual labels:  sqlalchemy, databases
ChefAPI
API using FastAPI and PostgreSQL for sharing or keeping track of awesome food recipes Based on Oauth2 and JWT 💎
Stars: ✭ 16 (-65.96%)
Mutual labels:  sqlalchemy
fastapi-saas-base
Fast API SAAS Base App
Stars: ✭ 47 (+0%)
Mutual labels:  sqlalchemy
db.rstudio.com
Website dedicated to all things R and Databases
Stars: ✭ 13 (-72.34%)
Mutual labels:  databases
favv
Fullstack Web Application Framework With FastAPI + Vite + VueJS. Streamlit for rapid development.
Stars: ✭ 17 (-63.83%)
Mutual labels:  sqlalchemy
Crema
Meta data server & client tools for game development
Stars: ✭ 61 (+29.79%)
Mutual labels:  databases
elasticsearch-dbapi
A DBAPI and SQLAlchemy dialect for Elasticsearch
Stars: ✭ 84 (+78.72%)
Mutual labels:  sqlalchemy
cloudrun-fastapi
FastAPI on Google Cloud Run
Stars: ✭ 112 (+138.3%)
Mutual labels:  sqlalchemy
flask-celery-sqlalchemy
An example app to show how to get Flask, Celery, and SQLAlchemy working together
Stars: ✭ 33 (-29.79%)
Mutual labels:  sqlalchemy
sqlconstruct
Functional approach to query database using SQLAlchemy
Stars: ✭ 22 (-53.19%)
Mutual labels:  sqlalchemy
tifa
Yet another opinionated fastapi-start-kit with best practice
Stars: ✭ 82 (+74.47%)
Mutual labels:  sqlalchemy
Qwerkey
Qwerkey is a social media platform for connecting and learning more about mechanical keyboards built on React and Redux in the frontend and Flask in the backend on top of a PostgreSQL database.
Stars: ✭ 22 (-53.19%)
Mutual labels:  sqlalchemy
pyramid basemodel
Global base classes for Pyramid SQLAlchemy applications.
Stars: ✭ 14 (-70.21%)
Mutual labels:  sqlalchemy
Apollo
A basic Application with multiple functionalities built with FastAPI aim to help Users Buy New Items Provided using PaypalAPI 🚀
Stars: ✭ 22 (-53.19%)
Mutual labels:  sqlalchemy

SQLAlchemy-Enum34

https://badge.fury.io/py/SQLAlchemy-Enum34.svg? https://travis-ci.org/spoqa/sqlalchemy-enum34.svg?branch=master https://codecov.io/github/spoqa/sqlalchemy-enum34/coverage.svg?branch=master

This package provides a SQLAlchemy type to store values of standard enum.Enum (which became a part of standard library since Python 3.4). Its internal representation is equivalent to SQLAlchemy's built-in sqlalchemy.types.Enum, but its Python representation is not a str but enum.Enum.

Note that this works on Python 2.6 as well as 3.4, the latest version of Python, through enum34 package.

The following example shows how enum-typed columns can be declared:

import enum

from sqlalchemy import Column, Integer
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy_enum34 import EnumType

Base = declarative_base()

class Color(enum.Enum):
    black = 'black'
    white = 'white'
    navy = 'navy'
    red = 'red'

class Size(enum.Enum):
    small = 'S'
    medium = 'M'
    large = 'L'
    xlarge = 'XL'

class Shirt(Base):
    id = Column(Integer, primary_key=True)
    color = Column(EnumType(Color), nullable=False)
    size = Column(EnumType(Size, name='shirt_size'), nullable=False)

And the following REPL session shows how these columns work:

>>> shirt = session.query(Shirt).filter(Shirt.color == Color.navy).first()
>>> shirt.color
<Color.navy: 'navy'>
>>> shirt.size
<Size.large: 'large'>

Written by Hong Minhee at Spoqa, and distributed under MIT license.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].