Started using 'sqlservice'. Added support for many new tables.
This commit is contained in:
parent
9b7d7db996
commit
b77a7069ce
12 changed files with 390 additions and 125 deletions
|
|
@ -1,6 +1,6 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
|
||||
from pyjeeves.models.raw import Companies, DelivLoc
|
||||
from pyjeeves.models.raw import Company, DelivLoc
|
||||
|
||||
from pyjeeves import logging
|
||||
logger = logging.getLogger("PyJeeves." + __name__)
|
||||
|
|
@ -9,6 +9,7 @@ logger = logging.getLogger("PyJeeves." + __name__)
|
|||
# Relocate Jeeves modules to separate folder and let a "master" module handle imports, and setup.
|
||||
class Location():
|
||||
"""Handles dispatch locations in Jeeves"""
|
||||
|
||||
def __init__(self):
|
||||
super(Location, self).__init__()
|
||||
self.associated_company = '' # Company with new/existing locations
|
||||
|
|
@ -30,7 +31,7 @@ class Location():
|
|||
def create_lev_location(self, ftgnr='', name='', address='',
|
||||
postal_code='', city='', gln='', invoice_ref='', phone=''):
|
||||
|
||||
_loc = Companies(
|
||||
_loc = Company(
|
||||
FtgNr=str(ftgnr), FtgNamn=name, FtgPostadr5=address,
|
||||
FtgLevPostNr=postal_code, FtgPostLevAdr3=city,
|
||||
EAN_Loc_Code=gln, FtgPostAdr1=invoice_ref, ComNr=phone,
|
||||
|
|
@ -49,21 +50,21 @@ class Location():
|
|||
for deliv_loc in self._deliv_locs:
|
||||
deliv_loc.merge()
|
||||
# self.session.merge(deliv_loc) # Create "connnections" between Customer and Location.
|
||||
Companies.commit()
|
||||
Company.commit()
|
||||
# self.session.commit()
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
# print([column.key for column in Companies.__table__.columns])
|
||||
# print([column.key for column in Company.__table__.columns])
|
||||
|
||||
logger.info("Starting TEST")
|
||||
# session = RawSession()
|
||||
|
||||
logger.info("Testing gettings a company")
|
||||
# c1 = session.query(Companies).filter_by(FtgNr="179580").first()
|
||||
print(Companies)
|
||||
c1 = Companies.query.filter_by(FtgNr="179580").first()
|
||||
# c1 = session.query(Company).filter_by(FtgNr="179580").first()
|
||||
print(Company)
|
||||
c1 = Company.query.filter_by(FtgNr="179580").first()
|
||||
logger.info(c1.json)
|
||||
# RawSession.remove()
|
||||
# from sqlalchemy.inspection import inspect
|
||||
# print (inspect(Companies).columns.items())
|
||||
# print (inspect(Company).columns.items())
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue