| Line 5... |
Line 5... |
| 5 |
'''
|
5 |
'''
|
| 6 |
from elixir import metadata, setup_all
|
6 |
from elixir import metadata, setup_all
|
| 7 |
from elixir.entity import Entity
|
7 |
from elixir.entity import Entity
|
| 8 |
from elixir.fields import Field
|
8 |
from elixir.fields import Field
|
| 9 |
from elixir.options import using_options, using_table_options
|
9 |
from elixir.options import using_options, using_table_options
|
| 10 |
from elixir.relationships import OneToMany, ManyToOne, ManyToMany
|
10 |
from elixir.relationships import OneToMany, ManyToOne
|
| 11 |
from sqlalchemy import create_engine
|
11 |
from sqlalchemy import create_engine
|
| 12 |
from sqlalchemy.types import Integer, String, DateTime, Float, Boolean, Text,\
|
12 |
from sqlalchemy.types import Integer, String, DateTime, Float, Boolean, Text, Enum
|
| 13 |
Date, Enum
|
- |
|
| 14 |
import datetime
|
13 |
import datetime
|
| 15 |
import elixir
|
14 |
import elixir
|
| 16 |
|
15 |
|
| 17 |
class Vendor(Entity):
|
16 |
class Vendor(Entity):
|
| 18 |
id = Field(Integer, primary_key=True, autoincrement=True)
|
17 |
id = Field(Integer, primary_key=True, autoincrement=True)
|
| Line 246... |
Line 245... |
| 246 |
isIgnored = Field(Boolean)
|
245 |
isIgnored = Field(Boolean)
|
| 247 |
timestamp = Field(DateTime)
|
246 |
timestamp = Field(DateTime)
|
| 248 |
using_options(shortnames=True)
|
247 |
using_options(shortnames=True)
|
| 249 |
using_table_options(mysql_engine="InnoDB")
|
248 |
using_table_options(mysql_engine="InnoDB")
|
| 250 |
|
249 |
|
| - |
|
250 |
class ItemAvailabilityCache(Entity):
|
| - |
|
251 |
itemId = Field(Integer, primary_key=True, autoincrement=False)
|
| - |
|
252 |
warehouseId = Field(Integer)
|
| - |
|
253 |
expectedDelay = Field(Integer)
|
| - |
|
254 |
billingWarehouseId = Field(Integer)
|
| - |
|
255 |
sellingPrice = Field(Float)
|
| - |
|
256 |
using_options(shortnames=True)
|
| - |
|
257 |
using_table_options(mysql_engine="InnoDB")
|
| - |
|
258 |
|
| 251 |
def initialize(dbname='catalog', db_hostname="localhost"):
|
259 |
def initialize(dbname='catalog', db_hostname="localhost"):
|
| 252 |
#metadata.bind = "sqlite:///inventory-new.sqlite" #need to read it from configserver.
|
260 |
#metadata.bind = "sqlite:///inventory-new.sqlite" #need to read it from configserver.
|
| 253 |
#metadata.bind = 'mysql://root:shop2020@localhost/catalog'
|
261 |
#metadata.bind = 'mysql://root:shop2020@localhost/catalog'
|
| 254 |
engine = create_engine('mysql://root:shop2020@' + db_hostname + '/' + dbname, pool_recycle=7200)
|
262 |
engine = create_engine('mysql://root:shop2020@' + db_hostname + '/' + dbname, pool_recycle=7200)
|
| 255 |
metadata.bind = engine
|
263 |
metadata.bind = engine
|