root / xap / tags / 0.1.5 / model.py

Revision 226:7bbf27312bd7, 0.8 kB (checked in by Lafaye Philippe (RAGE2000) <lafaye@…>, 8 months ago)

Add a new version

Line 
1import os
2from settings import SQLURI
3from sqlalchemy import *
4
5sql_db = create_engine(SQLURI, convert_unicode=True)
6metadata = BoundMetaData(sql_db)
7
8
9index_data = Table('xap_index_data', metadata,
10                   Column('docid', String(10)),
11                   Column('language_iso', String(2)),
12                   Column('data', TEXT()))
13
14try:
15    index_data.create()
16except exceptions.SQLError:
17    # already exists
18    pass
19
20remove_data = Table('xap_remove_data', metadata,
21                   Column('docid', String(10)),)
22
23try:
24    remove_data.create()
25except exceptions.SQLError:
26    # already exists
27    pass
28
29statistics = Table('xap_statistics', metadata,
30                   Column('query', String(200)),
31                   Column('count', Integer))
32
33try:
34    statistics.create()
35except exceptions.SQLError:
36    # already exists
37    pass
38
Note: See TracBrowser for help on using the browser.