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