]> andersk Git - sql.git/blob - lib/python/mitsql/db.py
begin restructuring
[sql.git] / lib / python / mitsql / db.py
1 from elixir import Entity, Field, String, Text, Integer, DateTime, options, metadata, setup_all, session
2 from sqlalchemy import create_engine, func
3 options.options_defaults['shortnames'] = True
4
5 class Backup(Entity):
6     db = Field(String(256), primary_key=True)
7     skip_reason = Field(String(256), nullable=True)
8     skip_date = Field(DateTime(), nullable=True)
9     dump_path = Field(String(512), nullable=True)
10     dump_errnum = Field(Integer(4), nullable=True)
11     dump_errstr = Field(Text(), nullable=True)
12     dump_date = Field(DateTime(), nullable=True)
13
14 metadata.bind = create_engine('mysql://sql.mit.edu/mitsql?read_default_group=mysql', pool_recycle=True)
15
16 if __name__ == '__main__':
17     setup_all(True)
18 else:
19     setup_all()
20 session.flush()
This page took 0.030507 seconds and 5 git commands to generate.