-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathquran_db.py
47 lines (38 loc) · 1.42 KB
/
quran_db.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# quran_db.py: move quran.db to mysql db
from sqlalchemy.orm import scoped_session, sessionmaker
from sqlalchemy import create_engine
from sqlalchemy.schema import ThreadLocalMetaData
from elixir import *
import os, os.path
a_engine = create_engine('sqlite:///'+os.path.expanduser("~/python-modules/quran_quize/quran.db"))
a_session = scoped_session(sessionmaker(autoflush=True))
a_metadata = metadata
__metadata__ = a_metadata
__session__ = a_session
a_metadata.bind = a_engine
a_session.bind = a_engine
class Quran(Entity):
using_options(tablename = 'Quran')
rowid = Field(Integer, primary_key = True)
othmani = Field(UnicodeText)
imlai = Field(UnicodeText)
class Sajadat(Entity):
using_options(tablename = 'Sajadat')
rowid = Field(Integer, primary_key = True)
sura = Field(Integer,index = True, primary_key = True)
aya = Field(Integer)
sajda_type = Field(Integer)
comment = Field(UnicodeText)
class SuraInfo(Entity):
using_options(tablename = 'SuraInfo')
rowid = Field(Integer, primary_key = True)
sura_name = Field(UnicodeText, primary_key = True)
other_names = Field(UnicodeText)
makki = Field(Integer)
starting_row = Field(Integer)
comment = Field(UnicodeText)
class Tahzeeb(Entity):
using_options(tablename = 'Tahzeeb')
rowid = Field(Integer, primary_key = True)
sura = Field(Integer,index = True, primary_key = True)
aya = Field(Integer, primary_key = True)