Complete system for getting + saving Product Categories with new database, server, and client architecture.
This commit is contained in:
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -21,7 +21,7 @@ from business_objects.store.delivery_option import Delivery_Option
|
||||
from business_objects.store.delivery_region import Delivery_Region
|
||||
from business_objects.store.discount import Discount
|
||||
from business_objects.store.order import Order
|
||||
from business_objects.store.product import Product, Product_Permutation, Product_Price, Product_Filters # Permutation_Variation_Link
|
||||
from business_objects.store.product import Product, Product_Permutation, Product_Price, Filters_Product # Permutation_Variation_Link
|
||||
from business_objects.sql_error import SQL_Error
|
||||
from business_objects.store.stock_item import Stock_Item, Stock_Item_Filters
|
||||
from business_objects.user import User, User_Filters, User_Permission_Evaluation
|
||||
@@ -40,25 +40,31 @@ from pydantic import BaseModel, ConfigDict
|
||||
from typing import ClassVar
|
||||
from datetime import datetime
|
||||
|
||||
# db = SQLAlchemy()
|
||||
|
||||
|
||||
class DataStore_Base(BaseModel):
|
||||
# Global constants
|
||||
# Attributes
|
||||
"""
|
||||
app: Flask = None
|
||||
db: SQLAlchemy = None
|
||||
session: object = None
|
||||
"""
|
||||
|
||||
model_config = ConfigDict(arbitrary_types_allowed=True)
|
||||
# model_config = ConfigDict(arbitrary_types_allowed=True)
|
||||
|
||||
def __init__(self, **kwargs):
|
||||
super().__init__(**kwargs)
|
||||
# Constructor
|
||||
"""
|
||||
self.db = db
|
||||
self.app = current_app
|
||||
with self.app.app_context():
|
||||
self.session = session
|
||||
|
||||
def db_procedure_execute(self, proc_name, argument_dict_list = None):
|
||||
"""
|
||||
@staticmethod
|
||||
def db_procedure_execute(proc_name, argument_dict_list = None):
|
||||
# Argument validation
|
||||
_m = 'DataStore_Base.db_procedure_execute'
|
||||
av.val_str(proc_name, 'proc_name', _m)
|
||||
@@ -80,9 +86,9 @@ class DataStore_Base(BaseModel):
|
||||
# conn = Helper_DB_MySQL(self.app).get_db_connection()
|
||||
|
||||
if has_arguments:
|
||||
result = self.db.session.execute(proc_string, argument_dict_list)
|
||||
result = db.session.execute(proc_string, argument_dict_list)
|
||||
else:
|
||||
result = self.db.session.execute(proc_string)
|
||||
result = db.session.execute(proc_string)
|
||||
print(f'result: {result}')
|
||||
# conn.session.remove()
|
||||
return result
|
||||
@@ -93,11 +99,12 @@ class DataStore_Base(BaseModel):
|
||||
result_set_2 = cursor.fetchall()
|
||||
print(f'products: {result_set_2}')
|
||||
|
||||
@staticmethod
|
||||
def db_cursor_clear(cursor):
|
||||
while cursor.nextset():
|
||||
print(f'new result set: {cursor.fetchall()}')
|
||||
|
||||
def get_regions_and_currencies(self):
|
||||
@classmethod
|
||||
def get_regions_and_currencies(cls):
|
||||
_m = 'DataStore_Base.get_regions_and_currencies'
|
||||
_m_db_currency = 'p_shop_get_many_currency'
|
||||
_m_db_region = 'p_shop_get_many_region'
|
||||
@@ -110,7 +117,7 @@ class DataStore_Base(BaseModel):
|
||||
}
|
||||
|
||||
print(f'executing {_m_db_currency}')
|
||||
result = self.db_procedure_execute(_m_db_currency, argument_dict_list_currency)
|
||||
result = cls.db_procedure_execute(_m_db_currency, argument_dict_list_currency)
|
||||
cursor = result.cursor
|
||||
print('data received')
|
||||
|
||||
@@ -118,13 +125,13 @@ class DataStore_Base(BaseModel):
|
||||
result_set_1 = cursor.fetchall()
|
||||
currencies = []
|
||||
for row in result_set_1:
|
||||
currency = Currency.from_DB_currency(row)
|
||||
currency = Currency.make_from_DB_currency(row)
|
||||
currencies.append(currency)
|
||||
print(f'currencies: {currencies}')
|
||||
DataStore_Base.db_cursor_clear(cursor)
|
||||
|
||||
print(f'executing {_m_db_region}')
|
||||
result = self.db_procedure_execute(_m_db_region, argument_dict_list_region)
|
||||
result = cls.db_procedure_execute(_m_db_region, argument_dict_list_region)
|
||||
cursor = result.cursor
|
||||
print('data received')
|
||||
|
||||
@@ -132,15 +139,16 @@ class DataStore_Base(BaseModel):
|
||||
result_set_1 = cursor.fetchall()
|
||||
regions = []
|
||||
for row in result_set_1:
|
||||
region = Delivery_Region.from_DB_region(row)
|
||||
region = Delivery_Region.make_from_DB_region(row)
|
||||
regions.append(region)
|
||||
print(f'regions: {regions}')
|
||||
DataStore_Base.db_cursor_clear(cursor)
|
||||
cursor.close()
|
||||
|
||||
return regions, currencies
|
||||
|
||||
def get_user_session(self):
|
||||
return User.from_json(self.session.get(User.KEY_USER))
|
||||
@staticmethod
|
||||
def get_user_session():
|
||||
return User.from_json(session.get(User.KEY_USER))
|
||||
user = User.get_default()
|
||||
try:
|
||||
print(f'user session: {session[self.app.ID_TOKEN_USER]}')
|
||||
@@ -152,7 +160,21 @@ class DataStore_Base(BaseModel):
|
||||
except:
|
||||
print('get user login failed')
|
||||
return user
|
||||
|
||||
def get_user_auth0(self):
|
||||
return User.from_json_auth0(self.session.get(self.app.config['ID_TOKEN_USER']))
|
||||
|
||||
@staticmethod
|
||||
def get_user_auth0():
|
||||
return User.from_json_auth0(session.get(current_app.config['ID_TOKEN_USER']))
|
||||
@staticmethod
|
||||
def upload_bulk(objects, objectType, batch_size):
|
||||
_m = 'DataStore_Base.upload_bulk'
|
||||
print(f'{_m}\nstarting...')
|
||||
try:
|
||||
for i in range(0, len(objects), batch_size):
|
||||
batch = objects[i:i+batch_size]
|
||||
data = [object.to_json() for object in batch]
|
||||
print(f'batch: {batch}\ndata: {data}')
|
||||
db.session.bulk_insert_mappings(objectType, data)
|
||||
db.session.commit()
|
||||
except Exception as e:
|
||||
print(f'{_m}\n{e}')
|
||||
db.session.rollback()
|
||||
raise e
|
||||
@@ -21,7 +21,7 @@ from business_objects.store.delivery_option import Delivery_Option
|
||||
from business_objects.store.delivery_region import Delivery_Region
|
||||
from business_objects.store.discount import Discount
|
||||
from business_objects.store.order import Order
|
||||
from business_objects.store.product import Product, Product_Permutation, Product_Price, Product_Filters
|
||||
from business_objects.store.product import Product, Product_Permutation, Product_Price, Filters_Product
|
||||
from business_objects.sql_error import SQL_Error
|
||||
from business_objects.store.stock_item import Stock_Item, Stock_Item_Filters
|
||||
from business_objects.user import User, User_Filters, User_Permission_Evaluation
|
||||
@@ -41,6 +41,8 @@ from pydantic import BaseModel, ConfigDict
|
||||
from typing import ClassVar
|
||||
from datetime import datetime
|
||||
|
||||
# db = SQLAlchemy()
|
||||
|
||||
|
||||
class DataStore_Store_Base(DataStore_Base):
|
||||
# Global constants
|
||||
@@ -52,17 +54,17 @@ class DataStore_Store_Base(DataStore_Base):
|
||||
|
||||
def __init__(self, **kwargs):
|
||||
super().__init__(**kwargs)
|
||||
|
||||
def get_many_product(self, product_filters):
|
||||
@classmethod
|
||||
def get_many_product(cls, product_filters):
|
||||
# redundant argument validation?
|
||||
_m = 'DataStore_Store_Base.get_many_product'
|
||||
av.val_instance(product_filters, 'product_filters', _m, Product_Filters)
|
||||
av.val_instance(product_filters, 'product_filters', _m, Filters_Product)
|
||||
argument_dict = product_filters.to_json()
|
||||
user = self.get_user_session()
|
||||
user = cls.get_user_session()
|
||||
argument_dict['a_id_user'] = 1 # 'auth0|6582b95c895d09a70ba10fef' # id_user
|
||||
print(f'argument_dict: {argument_dict}')
|
||||
print('executing p_shop_get_many_product')
|
||||
result = self.db_procedure_execute('p_shop_get_many_product', argument_dict)
|
||||
result = cls.db_procedure_execute('p_shop_get_many_product', argument_dict)
|
||||
cursor = result.cursor
|
||||
print('data received')
|
||||
|
||||
@@ -85,35 +87,36 @@ class DataStore_Store_Base(DataStore_Base):
|
||||
cursor.nextset()
|
||||
result_set_2 = cursor.fetchall()
|
||||
# print(f'products: {result_set_2}')
|
||||
products = [] # [Product(**row) for row in result_set_2]
|
||||
product_index = {}
|
||||
# products = [] # [Product(**row) for row in result_set_2]
|
||||
# product_index = {}
|
||||
for row in result_set_2:
|
||||
new_product = Product.from_DB_product(row) # (row[0], row[1], row[2], row[3], row[4], row[5], row[6], row[7], row[8], row[9], row[10], row[11], row[12], row[13], row[14], row[15], row[16], row[17], row[18], row[19])
|
||||
index_category = category_list.get_index_category_from_id(new_product.id_category)
|
||||
category = category_list.categories[index_category]
|
||||
category_list.add_product(new_product)
|
||||
# products.append(new_product)
|
||||
print(f'category_list: {category_list}')
|
||||
|
||||
# Permutations
|
||||
cursor.nextset()
|
||||
result_set_3 = cursor.fetchall()
|
||||
# print(f'Permutations: {result_set_3}')
|
||||
permutations = [] # [Product(**row) for row in result_set_2]
|
||||
# permutation_index = {}
|
||||
for row in result_set_3:
|
||||
new_permutation = Product_Permutation.from_DB_product(row) # (row[0], row[1], row[2], row[3], row[4], row[5], row[6], row[7], row[8], row[9], row[10], row[11], row[12], row[13], row[14], row[15], row[16], row[17], row[18], row[19])
|
||||
index_category = category_list.get_index_category_from_id(new_permutation.id_category)
|
||||
category = category_list.categories[index_category]
|
||||
try:
|
||||
index_product = category.get_index_product_from_id(new_permutation.id_product)
|
||||
category_list.add_permutation(new_permutation)
|
||||
# product = products[index_product]
|
||||
# product.add_permutation(new_permutation)
|
||||
except KeyError:
|
||||
product_index[new_permutation.id_product] = len(products)
|
||||
product = Product.from_DB_product(row)
|
||||
product.add_permutation(new_permutation)
|
||||
products.append(product)
|
||||
# categories[category_index[new_product.id_category]].add_product(new_product)
|
||||
category_list.add_product(product)
|
||||
# category_list.add_permutation(new_permutation)
|
||||
# print(f'products: {[p.id_product for p in products]}') # {products}')
|
||||
category_list.add_permutation(new_permutation)
|
||||
print(f'category_list: {category_list}')
|
||||
|
||||
# Product_Variations
|
||||
cursor.nextset()
|
||||
result_set_3 = cursor.fetchall()
|
||||
# print(f'variations: {result_set_3}')
|
||||
# variations = [Product_Variation(**row) for row in result_set_3]
|
||||
result_set_4 = cursor.fetchall()
|
||||
# print(f'variations: {result_set_4}')
|
||||
# variations = [Product_Variation(**row) for row in result_set_4]
|
||||
variations = []
|
||||
for row in result_set_3:
|
||||
for row in result_set_4:
|
||||
new_variation = Product_Variation.from_DB_product(row) # (row[0], row[1], row[2], row[3], row[4], row[5], row[6], row[7])
|
||||
variations.append(new_variation)
|
||||
# products[product_index[new_variation.id_product]].variations.append(new_variation)
|
||||
@@ -127,8 +130,8 @@ class DataStore_Store_Base(DataStore_Base):
|
||||
# Images
|
||||
cursor.nextset()
|
||||
result_set_5 = cursor.fetchall()
|
||||
# print(f'images: {result_set_4}')
|
||||
# images = [Image(**row) for row in result_set_4]
|
||||
# print(f'images: {result_set_5}')
|
||||
# images = [Image(**row) for row in result_set_5]
|
||||
images = []
|
||||
for row in result_set_5:
|
||||
new_image = Image.from_DB_product(row) # (row[0], row[1], row[2], row[3], row[4])
|
||||
@@ -179,6 +182,7 @@ class DataStore_Store_Base(DataStore_Base):
|
||||
|
||||
|
||||
DataStore_Store_Base.db_cursor_clear(cursor)
|
||||
cursor.close()
|
||||
|
||||
return category_list, errors # categories, category_index
|
||||
|
||||
@@ -192,7 +196,7 @@ class DataStore_Store_Base(DataStore_Base):
|
||||
price_ids.append() # get price id
|
||||
return price_ids
|
||||
"""
|
||||
|
||||
@staticmethod
|
||||
def get_ids_permutation_from_error_availability(msg_error_availability):
|
||||
ids_permutation = []
|
||||
index_colon = msg_error_availability.find(':', msg_error_availability.find(':'))
|
||||
@@ -203,8 +207,8 @@ class DataStore_Store_Base(DataStore_Base):
|
||||
index_comma = msg_error_availability.find(',')
|
||||
ids_permutation.append(msg_error_availability[:index_comma])
|
||||
return ids_permutation
|
||||
|
||||
def get_regions_and_currencies(self):
|
||||
@classmethod
|
||||
def get_regions_and_currencies(cls):
|
||||
_m = 'DataStore_Store_Base.get_regions_and_currencies'
|
||||
_m_db_currency = 'p_shop_get_many_currency'
|
||||
_m_db_region = 'p_shop_get_many_region'
|
||||
@@ -217,7 +221,7 @@ class DataStore_Store_Base(DataStore_Base):
|
||||
}
|
||||
|
||||
print(f'executing {_m_db_currency}')
|
||||
result = self.db_procedure_execute(_m_db_currency, argument_dict_list_currency)
|
||||
result = cls.db_procedure_execute(_m_db_currency, argument_dict_list_currency)
|
||||
cursor = result.cursor
|
||||
print('data received')
|
||||
|
||||
@@ -231,7 +235,7 @@ class DataStore_Store_Base(DataStore_Base):
|
||||
DataStore_Store_Base.db_cursor_clear(cursor)
|
||||
|
||||
print(f'executing {_m_db_region}')
|
||||
result = self.db_procedure_execute(_m_db_region, argument_dict_list_region)
|
||||
result = cls.db_procedure_execute(_m_db_region, argument_dict_list_region)
|
||||
cursor = result.cursor
|
||||
print('data received')
|
||||
|
||||
@@ -243,10 +247,11 @@ class DataStore_Store_Base(DataStore_Base):
|
||||
regions.append(region)
|
||||
print(f'regions: {regions}')
|
||||
DataStore_Store_Base.db_cursor_clear(cursor)
|
||||
cursor.close()
|
||||
|
||||
return regions, currencies
|
||||
|
||||
def get_many_product_variation(self, variation_filters):
|
||||
@classmethod
|
||||
def get_many_product_variation(cls, variation_filters):
|
||||
_m = 'DataStore_Store_Base.get_many_product_variation'
|
||||
print(_m)
|
||||
av.val_instance(variation_filters, 'variation_filters', _m, Product_Variation_Filters)
|
||||
@@ -262,14 +267,14 @@ class DataStore_Store_Base(DataStore_Base):
|
||||
'a_guid': guid
|
||||
}
|
||||
"""
|
||||
user = self.get_user_session()
|
||||
user = cls.get_user_session()
|
||||
argument_dict_list = {
|
||||
# 'a_guid': guid
|
||||
'a_id_user': user.id_user
|
||||
, **variation_filters.to_json()
|
||||
}
|
||||
# argument_dict_list['a_guid'] = guid
|
||||
result = self.db_procedure_execute('p_shop_get_many_product_variation', argument_dict_list)
|
||||
result = cls.db_procedure_execute('p_shop_get_many_product_variation', argument_dict_list)
|
||||
|
||||
cursor = result.cursor
|
||||
result_set = cursor.fetchall()
|
||||
@@ -290,5 +295,7 @@ class DataStore_Store_Base(DataStore_Base):
|
||||
print(f"Error [{error.code}]: {error.msg}")
|
||||
|
||||
DataStore_Store_Base.db_cursor_clear(cursor)
|
||||
|
||||
cursor.close()
|
||||
|
||||
return variations, errors
|
||||
@@ -21,7 +21,7 @@ from business_objects.store.delivery_option import Delivery_Option
|
||||
from business_objects.store.delivery_region import Delivery_Region
|
||||
from business_objects.store.discount import Discount
|
||||
from business_objects.store.order import Order
|
||||
from business_objects.store.product import Product, Product_Permutation, Product_Price, Product_Filters
|
||||
from business_objects.store.product import Product, Product_Permutation, Product_Price, Filters_Product
|
||||
from business_objects.sql_error import SQL_Error
|
||||
from business_objects.store.stock_item import Stock_Item, Stock_Item_Filters
|
||||
from business_objects.user import User, User_Filters, User_Permission_Evaluation
|
||||
@@ -41,6 +41,8 @@ from pydantic import BaseModel, ConfigDict
|
||||
from typing import ClassVar
|
||||
from datetime import datetime
|
||||
|
||||
# db = SQLAlchemy()
|
||||
|
||||
|
||||
class DataStore_Store_Basket(DataStore_Store_Base):
|
||||
# Global constants
|
||||
|
||||
@@ -20,11 +20,12 @@ from business_objects.store.delivery_option import Delivery_Option
|
||||
from business_objects.store.delivery_region import Delivery_Region
|
||||
from business_objects.store.discount import Discount
|
||||
from business_objects.store.order import Order
|
||||
from business_objects.store.product import Product, Product_Permutation, Product_Price, Product_Filters
|
||||
from business_objects.store.product import Product, Product_Permutation, Product_Price, Filters_Product
|
||||
from business_objects.sql_error import SQL_Error
|
||||
from business_objects.store.stock_item import Stock_Item, Stock_Item_Filters
|
||||
from business_objects.user import User, User_Filters, User_Permission_Evaluation
|
||||
from business_objects.store.product_variation import Product_Variation, Product_Variation_Filters, Product_Variation_List
|
||||
# from datastores.datastore_base import Table_Shop_Product_Category, Table_Shop_Product_Category_Temp
|
||||
from datastores.datastore_store_base import DataStore_Store_Base
|
||||
from helpers.helper_db_mysql import Helper_DB_MySQL
|
||||
# from models.model_view_store_checkout import Model_View_Store_Checkout # circular!
|
||||
@@ -40,36 +41,114 @@ from pydantic import BaseModel, ConfigDict
|
||||
from typing import ClassVar
|
||||
from datetime import datetime
|
||||
|
||||
# db = SQLAlchemy()
|
||||
|
||||
"""
|
||||
class Table_Shop_Product_Category(db.Model):
|
||||
__tablename__ = 'Shop_Product_Category'
|
||||
id_category: int = db.Column(db.Integer, primary_key=True)
|
||||
code: str = db.Column(db.String(50))
|
||||
name: str = db.Column(db.String(255))
|
||||
description: str = db.Column(db.String(4000))
|
||||
active: bool = db.Column(db.Boolean)
|
||||
display_order: int = db.Column(db.Integer)
|
||||
created_on: datetime = db.Column(db.DateTime)
|
||||
created_by: int = db.Column(db.Integer)
|
||||
id_change_set: int = db.Column(db.Integer)
|
||||
"""
|
||||
class Row_Shop_Product_Category_Temp(db.Model):
|
||||
__tablename__ = 'Shop_Product_Category_Temp'
|
||||
__table_args__ = { 'extend_existing': True }
|
||||
id_category: int = db.Column(db.Integer, primary_key=True)
|
||||
code: str = db.Column(db.String(50))
|
||||
name: str = db.Column(db.String(255))
|
||||
description: str = db.Column(db.String(4000))
|
||||
active: bool = db.Column(db.Boolean)
|
||||
display_order: int = db.Column(db.Integer)
|
||||
guid: str = db.Column(db.BINARY(36))
|
||||
created_on: datetime = db.Column(db.DateTime)
|
||||
created_by: int = db.Column(db.Integer)
|
||||
|
||||
@classmethod
|
||||
def from_product_category(cls, product_category):
|
||||
row = cls()
|
||||
row.id_category = product_category.id_category[0] if isinstance(product_category.id_category, tuple) else product_category.id_category
|
||||
row.code = product_category.code[0] if isinstance(product_category.code, tuple) else product_category.code
|
||||
row.name = product_category.name[0] if isinstance(product_category.name, tuple) else product_category.name
|
||||
row.description = product_category.description[0] if isinstance(product_category.description, tuple) else product_category.description
|
||||
row.active = product_category.active
|
||||
row.display_order = product_category.display_order
|
||||
"""
|
||||
row.guid = product_category.guid
|
||||
row.created_on = product_category.created_on
|
||||
row.created_by = product_category.created_by
|
||||
"""
|
||||
return row
|
||||
def to_json(self):
|
||||
return {
|
||||
'id_category': self.id_category,
|
||||
'code': self.code,
|
||||
'name': self.name,
|
||||
'description': self.description,
|
||||
'active': self.active,
|
||||
'display_order': self.display_order,
|
||||
'guid': self.guid,
|
||||
'created_on': self.created_on,
|
||||
'created_by': self.created_by
|
||||
}
|
||||
|
||||
|
||||
class DataStore_Store_Product_Category(DataStore_Store_Base):
|
||||
def __init__(self):
|
||||
super().__init__()
|
||||
|
||||
def save_categories(self, comment, categories):
|
||||
@classmethod
|
||||
def save_categories(cls, comment, categories):
|
||||
_m = 'DataStore_Store_Product_Category.save_categories'
|
||||
av.val_str(comment, 'comment', _m)
|
||||
av.val_list(categories, 'categories', _m, Product_Category, 1)
|
||||
print(f'{_m}\nstarting...')
|
||||
print(f'comment: {comment}\ncategories: {categories}')
|
||||
# av.val_str(comment, 'comment', _m)
|
||||
# av.val_list_instances(categories, 'categories', _m, Product_Category, 1)
|
||||
|
||||
guid = Helper_DB_MySQL.create_guid()
|
||||
now = datetime.now()
|
||||
user = self.get_user_session()
|
||||
for permutation in permutations:
|
||||
setattr(permutation, 'guid', guid)
|
||||
setattr(permutation, 'created_on', now)
|
||||
setattr(permutation, 'created_by', user.id_user)
|
||||
user = cls.get_user_session()
|
||||
rows = []
|
||||
id_category_new = 0
|
||||
for category in categories:
|
||||
row = Row_Shop_Product_Category_Temp.from_product_category(category)
|
||||
# id_tmp =
|
||||
if row.id_category == '':
|
||||
id_category_new -= 1
|
||||
row.id_category = id_category_new
|
||||
else:
|
||||
print(f'row.id_category: {row.id_category}')
|
||||
row.guid = guid
|
||||
row.created_on = now
|
||||
row.created_by = user.id_user
|
||||
rows.append(row)
|
||||
|
||||
cursor = self.db.cursor()
|
||||
print(f'rows: {rows}')
|
||||
"""
|
||||
cursor = db.cursor()
|
||||
print('cursor created')
|
||||
cursor.executemany(
|
||||
'INSERT INTO Shop_Product_Permutation_Temp (id_permutation, id_product, description, cost_local, id_currency_cost, profit_local_min, latency_manufacture, quantity_min, quantity_max, quantity_step, quantity_stock, is_subscription, id_recurrence_interval, count_recurrence_interval, id_stripe_product, active, display_order, guid) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)',
|
||||
permutations
|
||||
'INSERT INTO Shop_Product_Category_Temp (id_category, code, name, description, active, display_order, guid, created_on, created_by) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)',
|
||||
categories
|
||||
)
|
||||
self.db.commit()
|
||||
|
||||
print('bulk upload executed')
|
||||
db.commit()
|
||||
print('bulk upload committed')
|
||||
cursor.close()
|
||||
print('cursor closed')
|
||||
"""
|
||||
DataStore_Store_Base.upload_bulk(rows, Row_Shop_Product_Category_Temp, 1000)
|
||||
|
||||
argument_dict_list = {
|
||||
'a_id_user': user.id_user,
|
||||
'a_guid': guid,
|
||||
'a_comment': comment,
|
||||
'a_guid': guid
|
||||
}
|
||||
self.db_procedure_execute('p_shop_save_permutation', argument_dict_list)
|
||||
|
||||
cursor.close()
|
||||
save_result = cls.db_procedure_execute('p_shop_save_product_category', argument_dict_list)
|
||||
save_result.close()
|
||||
print('save procedure executed')
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@ from business_objects.store.delivery_option import Delivery_Option
|
||||
from business_objects.store.delivery_region import Delivery_Region
|
||||
from business_objects.store.discount import Discount
|
||||
from business_objects.store.order import Order
|
||||
from business_objects.store.product import Product, Product_Permutation, Product_Price, Product_Filters
|
||||
from business_objects.store.product import Product, Product_Permutation, Product_Price, Filters_Product
|
||||
from business_objects.sql_error import SQL_Error
|
||||
from business_objects.store.stock_item import Stock_Item, Stock_Item_Filters
|
||||
from business_objects.user import User, User_Filters, User_Permission_Evaluation
|
||||
@@ -40,6 +40,8 @@ from pydantic import BaseModel, ConfigDict
|
||||
from typing import ClassVar
|
||||
from datetime import datetime
|
||||
|
||||
# db = SQLAlchemy()
|
||||
|
||||
|
||||
class DataStore_Store_Product_Permutation(DataStore_Store_Base):
|
||||
def __init__(self):
|
||||
|
||||
@@ -21,7 +21,7 @@ from business_objects.store.delivery_option import Delivery_Option
|
||||
from business_objects.store.delivery_region import Delivery_Region
|
||||
from business_objects.store.discount import Discount
|
||||
from business_objects.store.order import Order
|
||||
from business_objects.store.product import Product, Product_Permutation, Product_Price, Product_Filters
|
||||
from business_objects.store.product import Product, Product_Permutation, Product_Price, Filters_Product
|
||||
from business_objects.sql_error import SQL_Error
|
||||
from business_objects.store.stock_item import Stock_Item, Stock_Item_Filters
|
||||
from business_objects.user import User, User_Filters, User_Permission_Evaluation
|
||||
@@ -41,6 +41,8 @@ from pydantic import BaseModel, ConfigDict
|
||||
from typing import ClassVar
|
||||
from datetime import datetime
|
||||
|
||||
# db = SQLAlchemy()
|
||||
|
||||
|
||||
class DataStore_Store_Product_Variation(DataStore_Store_Base):
|
||||
# Global constants
|
||||
|
||||
@@ -21,7 +21,7 @@ from business_objects.store.delivery_option import Delivery_Option
|
||||
from business_objects.store.delivery_region import Delivery_Region
|
||||
from business_objects.store.discount import Discount
|
||||
from business_objects.store.order import Order
|
||||
from business_objects.store.product import Product, Product_Permutation, Product_Price, Product_Filters
|
||||
from business_objects.store.product import Product, Product_Permutation, Product_Price, Filters_Product
|
||||
from business_objects.sql_error import SQL_Error
|
||||
from business_objects.store.stock_item import Stock_Item, Stock_Item_Filters
|
||||
from business_objects.user import User, User_Filters, User_Permission_Evaluation
|
||||
@@ -41,6 +41,8 @@ from pydantic import BaseModel, ConfigDict
|
||||
from typing import ClassVar
|
||||
from datetime import datetime
|
||||
|
||||
# db = SQLAlchemy()
|
||||
|
||||
|
||||
class DataStore_Store_Stock_Item(DataStore_Store_Base):
|
||||
# Global constants
|
||||
|
||||
@@ -21,7 +21,7 @@ from business_objects.store.delivery_option import Delivery_Option
|
||||
from business_objects.store.delivery_region import Delivery_Region
|
||||
from business_objects.store.discount import Discount
|
||||
from business_objects.store.order import Order
|
||||
from business_objects.store.product import Product, Product_Permutation, Product_Price, Product_Filters
|
||||
from business_objects.store.product import Product, Product_Permutation, Product_Price, Filters_Product
|
||||
from business_objects.sql_error import SQL_Error
|
||||
from business_objects.store.stock_item import Stock_Item, Stock_Item_Filters
|
||||
from business_objects.user import User, User_Filters, User_Permission_Evaluation
|
||||
@@ -41,6 +41,8 @@ from pydantic import BaseModel, ConfigDict
|
||||
from typing import ClassVar
|
||||
from datetime import datetime
|
||||
|
||||
# db = SQLAlchemy()
|
||||
|
||||
|
||||
class DataStore_Store_Stripe(DataStore_Store_Base):
|
||||
# Global constants
|
||||
|
||||
@@ -21,7 +21,7 @@ from business_objects.store.delivery_option import Delivery_Option
|
||||
from business_objects.store.delivery_region import Delivery_Region
|
||||
from business_objects.store.discount import Discount
|
||||
from business_objects.store.order import Order
|
||||
from business_objects.store.product import Product, Product_Permutation, Product_Price, Product_Filters
|
||||
from business_objects.store.product import Product, Product_Permutation, Product_Price, Filters_Product
|
||||
from business_objects.sql_error import SQL_Error
|
||||
from business_objects.store.stock_item import Stock_Item, Stock_Item_Filters
|
||||
from business_objects.user import User, User_Filters, User_Permission_Evaluation
|
||||
@@ -41,6 +41,8 @@ from pydantic import BaseModel, ConfigDict
|
||||
from typing import ClassVar
|
||||
from datetime import datetime
|
||||
|
||||
# db = SQLAlchemy()
|
||||
|
||||
|
||||
class DataStore_User(DataStore_Base):
|
||||
# Global constants
|
||||
|
||||
Reference in New Issue
Block a user