Subversion Repositories SmartDukaan

Rev

Rev 12357 | Rev 17769 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 12357 Rev 12363
Line 9... Line 9...
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
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, Enum, Date, Text
12
from sqlalchemy.types import Integer, String, DateTime, Float, Boolean, Enum, Date, Text
13
import datetime
13
import datetime
-
 
14
 
14
class Vendor(Entity):
15
class Vendor(Entity):
15
    id = Field(Integer, primary_key=True, autoincrement=True)
16
    id = Field(Integer, primary_key=True, autoincrement=True)
16
    name = Field(String(50))
17
    name = Field(String(50))
17
    warehouses = OneToMany('Warehouse')
18
    warehouses = OneToMany('Warehouse')
18
    using_options(shortnames=True)
19
    using_options(shortnames=True)
Line 237... Line 238...
237
    grnDetail = Field(Text)
238
    grnDetail = Field(Text)
238
    stockQuantity = Field(Integer)
239
    stockQuantity = Field(Integer)
239
    avgWeightedNlc = Field(Float)
240
    avgWeightedNlc = Field(Float)
240
    using_options(shortnames=True)
241
    using_options(shortnames=True)
241
    using_table_options(mysql_engine="InnoDB")    
242
    using_table_options(mysql_engine="InnoDB")    
242
    
-
 
243
def initialize(dbname='inventory', db_hostname="localhost"):
243
def initialize(dbname='inventory', db_hostname="localhost"):
244
    #metadata.bind = "sqlite:///inventory-new.sqlite" #need to read it from configserver.
244
    #metadata.bind = "sqlite:///inventory-new.sqlite" #need to read it from configserver.
245
    #metadata.bind = 'mysql://root:shop2020@localhost/inventory'
245
    #metadata.bind = 'mysql://root:shop2020@localhost/inventory'
246
    iengine = create_engine('mysql://root:shop2020@' + db_hostname + '/' + dbname, pool_recycle=7200)
246
    iengine = create_engine('mysql://root:shop2020@' + db_hostname + '/' + dbname, pool_recycle=7200)
247
    metadata.bind = iengine
247
    metadata.bind = iengine