SQLAlchemy には event な機能が用意されていて、色々なタイミングをフックすることが出来ます。 すーぱー便利なので健忘録がてら簡単なサンプルとか書いてみました。 まずはこんなファイルを用意します。 # vim: fileencoding=utf-8 : from datetime import datetime from sqlalchemy import ( create_engine, Column, Integer, UnicodeText, DateTime, event, ) from sqlalchemy.ext.declarative import declarative_base from sqlalchemy.orm import sessionmaker __all__ = ('engine', 'session', 'metadata', 'Post'
http://blog.balancedpayments.com/the-ledger/1 comment | 0 pointsBalancedを取り上げるのは、「オープンカンパニー宣言したBalancedで働くエンジニア」以来、3ヶ月ぶりですが、今回は同社の本業に近い社内向けの会計アプリの話しです。 'balanced'と呼ばれる社内会計システム(社名と同じにしなくてもよいのに。。)のお金の流れの構成は、 Funding Instrument: お金の預け元(source)、もしくは預け先(destination)のこと。例えば、クレカはsourceの役割のみ。借方 (debit)、貸方 (credit)、払戻、取消(借方/貸方の反対仕訳)の取引がありえる。 Transaction (取引) : Marketplaceにあるエスクローアカウント(Funding Instrumentの一つ
Flask-Migrate¶ Flask-Migrate is an extension that handles SQLAlchemy database migrations for Flask applications using Alembic. The database operations are made available through the Flask command-line interface. Why Use Flask-Migrate vs. Alembic Directly?¶ Flask-Migrate is an extension that configures Alembic in the proper way to work with your Flask and Flask-SQLAlchemy application. In terms of t
from sqlalchemy.ext.declarative import declarative_base from sqlalchemy.schema import Column, ForeignKey from sqlalchemy.types import Integer, String from sqlalchemy.orm import relation from sqlalchemy.engine import create_engine from sqlalchemy.orm.session import sessionmaker Base = declarative_base() class User(Base): __tablename__ = 'users' id = Column(Integer, primary_key=True) name = Column(S
SQLAlchemy-ImageAttach¶ SQLAlchemy-ImageAttach is a SQLAlchemy extension for attaching images to entity objects. It provides the following features: Storage backend interface You can use file system backend on your local development box, and switch it to AWS S3 when it’s deployed to the production box. Or you can add a new backend implementation by yourself. Maintaining multiple image sizes Any si
From Zero to Holy Shit in 30 Minutes
Cross-DB Dump Script based on SQLAlchemy Support database : MySQL, PostgreSQL, SQLite, Oracle, Microsoft SQLServer etc. (See http://docs.sqlalchemy.org/en/rel_0_7/core/engines.html) Requirement Python 2.6 or later SQLAlchemy 0.7 or later How to use Usage: crossdb_dump.py [options] Options: --version show program's version number and exit -h, --help show this help message and exit -s driver://user[
リリース、障害情報などのサービスのお知らせ
最新の人気エントリーの配信
処理を実行中です
j次のブックマーク
k前のブックマーク
lあとで読む
eコメント一覧を開く
oページを開く