https://github.com/schematics/schemalchemy
SchemAlchemy = Schematics + SQLAlchemy
https://github.com/schematics/schemalchemy
Last synced: 12 months ago
JSON representation
SchemAlchemy = Schematics + SQLAlchemy
- Host: GitHub
- URL: https://github.com/schematics/schemalchemy
- Owner: schematics
- License: mit
- Created: 2014-07-16T16:50:19.000Z (about 12 years ago)
- Default Branch: master
- Last Pushed: 2017-11-20T15:46:35.000Z (over 8 years ago)
- Last Synced: 2025-04-14T12:21:18.154Z (over 1 year ago)
- Language: Python
- Size: 9.77 KB
- Stars: 21
- Watchers: 8
- Forks: 4
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- starred-awesome - schemalchemy - SchemAlchemy = Schematics + SQLAlchemy (Python)
README
SchemAlchemy
===========
Schematics + SQLAlchemy
## Usage
0. Import schemalchemy (before schematics)
1. Inherit from schemalchemy `Base`
2. Define the SQLAlchemy columns (or provide a Table)
3. Define the Schematics fields
Note: Column property names must be '_' + field_name (see about SQLAlchemy
`column_prefix` if you need to customize the prefix).
## Example
from schemalchemy import Base
from schematics.types import IntType, StringType
from sqlalchemy import Column, Integer, String
class Person(Base):
__tablename__ = 'person'
_id = Column('id', Integer, primary_key=True)
_name = Column('name', String(50))
id = IntType(default=1)
name = StringType()