Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/schematics/schemalchemy
SchemAlchemy = Schematics + SQLAlchemy
https://github.com/schematics/schemalchemy
Last synced: 3 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 (over 10 years ago)
- Default Branch: master
- Last Pushed: 2017-11-20T15:46:35.000Z (almost 7 years ago)
- Last Synced: 2024-07-31T14:48:53.286Z (3 months ago)
- Language: Python
- Size: 9.77 KB
- Stars: 21
- Watchers: 9
- 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 fieldsNote: 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, Stringclass Person(Base):
__tablename__ = 'person'
_id = Column('id', Integer, primary_key=True)
_name = Column('name', String(50))id = IntType(default=1)
name = StringType()