| Line 1... |
Line 1... |
| 1 |
from elixir import *
|
1 |
from elixir import *
|
| 2 |
from elixir import metadata, setup_all, session
|
- |
|
| 3 |
from elixir.entity import Entity
|
2 |
from elixir.entity import Entity
|
| 4 |
from elixir.fields import Field
|
3 |
from elixir.fields import Field
|
| 5 |
from elixir.options import using_options, using_table_options
|
4 |
from elixir.options import using_options, using_table_options
|
| 6 |
from sqlalchemy import create_engine
|
5 |
from sqlalchemy import create_engine
|
| - |
|
6 |
from sqlalchemy.ext.declarative import declarative_base
|
| - |
|
7 |
from sqlalchemy.schema import MetaData, Table, Column
|
| - |
|
8 |
from sqlalchemy.sql.expression import func
|
| 7 |
from sqlalchemy.types import Integer, String, DateTime, Float, Boolean, Enum, \
|
9 |
from sqlalchemy.types import Integer, String, DateTime, Float, Boolean, Enum, \
|
| 8 |
Text
|
10 |
Text
|
| 9 |
|
11 |
|
| 10 |
|
12 |
|
| 11 |
class Users(Entity):
|
13 |
class Users(Entity):
|
| Line 87... |
Line 89... |
| 87 |
district = Field(String(128))
|
89 |
district = Field(String(128))
|
| 88 |
state = Field(String(128))
|
90 |
state = Field(String(128))
|
| 89 |
using_options(shortnames=True)
|
91 |
using_options(shortnames=True)
|
| 90 |
using_table_options(mysql_engine="InnoDB")
|
92 |
using_table_options(mysql_engine="InnoDB")
|
| 91 |
|
93 |
|
| 92 |
class Dealers(Entity):
|
- |
|
| 93 |
id = Field(Integer(10, unsigned=True), primary_key=True)
|
- |
|
| 94 |
identifier = Field(String(128))
|
- |
|
| 95 |
title = Field(String(128))
|
- |
|
| 96 |
contact1 = Field(String(10))
|
- |
|
| 97 |
contact2 = Field(String(10))
|
- |
|
| 98 |
contact3 = Field(String(10))
|
- |
|
| 99 |
address = Field(String(192))
|
- |
|
| 100 |
lat = Field(String(16))
|
- |
|
| 101 |
lng = Field(String(16))
|
- |
|
| 102 |
established = Field(String(16))
|
- |
|
| 103 |
rating = Field(Integer(4, unsigned=True))
|
- |
|
| 104 |
verified = Field(Boolean)
|
- |
|
| 105 |
searchCity=Field(String(128))
|
- |
|
| 106 |
dealerUrl=Field(String(256))
|
- |
|
| 107 |
paginatedUrl=Field(String(256))
|
- |
|
| 108 |
rawhtml = Field(Text)
|
- |
|
| 109 |
using_options(shortnames=True)
|
- |
|
| 110 |
using_table_options(mysql_engine="InnoDB")
|
- |
|
| 111 |
|
- |
|
| 112 |
class Orders(Entity):
|
94 |
class Orders(Entity):
|
| 113 |
id = Field(Integer(unsigned=True), primary_key=True)
|
95 |
id = Field(Integer(unsigned=True), primary_key=True)
|
| 114 |
user_id = Field(Integer(unsigned=True), primary_key=True)
|
96 |
user_id = Field(Integer(unsigned=True), primary_key=True)
|
| 115 |
store_id = Field(Integer(unsigned=True), primary_key=True)
|
97 |
store_id = Field(Integer(unsigned=True), primary_key=True)
|
| 116 |
order_url = Field(String(256))
|
98 |
order_url = Field(String(256))
|
| Line 118... |
Line 100... |
| 118 |
created = Field(DateTime)
|
100 |
created = Field(DateTime)
|
| 119 |
modified = Field(DateTime)
|
101 |
modified = Field(DateTime)
|
| 120 |
using_options(shortnames=True)
|
102 |
using_options(shortnames=True)
|
| 121 |
using_table_options(mysql_engine="InnoDB")
|
103 |
using_table_options(mysql_engine="InnoDB")
|
| 122 |
|
104 |
|
| - |
|
105 |
class Retailers(Entity):
|
| - |
|
106 |
id = Field(Integer(unsigned=True), primary_key=True)
|
| - |
|
107 |
title = Field(String(256))
|
| - |
|
108 |
address = Field(String(512))
|
| - |
|
109 |
agent_id=Field(Integer(unsigned=True))
|
| - |
|
110 |
contact1 = Field(String(10))
|
| - |
|
111 |
contact2 = Field(String(10))
|
| - |
|
112 |
pin = Field(String(6))
|
| - |
|
113 |
state = Field(String(48))
|
| - |
|
114 |
status = Field(String(20))
|
| - |
|
115 |
retry_count = Field(Field(Integer(3)))
|
| - |
|
116 |
invalid_retry_count = Field(Field(Integer(3)))
|
| - |
|
117 |
call_priority = Field(Enum('user_initiated', 'system_initiated'))
|
| - |
|
118 |
next_call_time = Field(DateTime)
|
| - |
|
119 |
is_std = Field(Boolean(DateTime))
|
| - |
|
120 |
is_or = Field(Boolean(DateTime))
|
| - |
|
121 |
created = Field(DateTime)
|
| - |
|
122 |
modified = Field(DateTime, default=func.now(), onupdate=func.utc_timestamp())
|
| - |
|
123 |
using_options(shortnames=True)
|
| - |
|
124 |
using_table_options(mysql_engine="InnoDB")
|
| - |
|
125 |
|
| - |
|
126 |
class RetryConfig(Entity):
|
| - |
|
127 |
call_type = Field(Enum('fresh', 'followup'))
|
| - |
|
128 |
disposition_type = Field(Enum('call_later', 'ringing_no_answer', 'not_reachable', 'switch_off'))
|
| - |
|
129 |
retry_count = Field(Integer(unsigned=True))
|
| - |
|
130 |
days_ahead = Field(DateTime)
|
| - |
|
131 |
using_options(shortnames=True)
|
| - |
|
132 |
using_table_options(mysql_engine="InnoDB")
|
| - |
|
133 |
|
| - |
|
134 |
|
| 123 |
def initialize(dbname='dtr', db_hostname="localhost", echo=True):
|
135 |
def initialize(dbname='dtr', db_hostname="localhost", echo=True):
|
| 124 |
#metadata.bind = "sqlite:///inventory-new.sqlite" #need to read it from configserver.
|
136 |
#metadata.bind = "sqlite:///inventory-new.sqlite" #need to read it from configserver.
|
| 125 |
#metadata.bind = 'mysql://root:shop2020@localhost/catalog'
|
137 |
#metadata.bind = 'mysql://root:shop2020@localhost/catalog'
|
| 126 |
cengine = create_engine('mysql://root:shop2020@' + db_hostname + '/' + dbname, pool_recycle=7200)
|
138 |
cengine = create_engine('mysql://root:shop2020@' + db_hostname + '/' + dbname, pool_recycle=7200)
|
| 127 |
metadata.bind = cengine
|
139 |
metadata.bind = cengine
|