데이터가 정상적으로 들어가지 않는 부분 수정, 영수증번호와 품명, 수량이 동일한 경우 중복값으로 인식시키고 덮어씌우도록 수정함(일부 데이터가 중복 데이터가 존재)
This commit is contained in:
@ -1,7 +1,7 @@
|
||||
# db_schema.py
|
||||
import os
|
||||
import yaml
|
||||
from sqlalchemy import Table, Column, Date, Integer, String, Float, Text, MetaData, UniqueConstraint, DateTime, Time, PrimaryKeyConstraint
|
||||
from sqlalchemy import Table, Column, Date, Integer, String, Float, Text, MetaData, UniqueConstraint, DateTime, Time, PrimaryKeyConstraint, Index
|
||||
from sqlalchemy.sql import func
|
||||
|
||||
BASE_DIR = os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))
|
||||
@ -218,8 +218,8 @@ pos_ups_billdata = Table(
|
||||
get_full_table_name('pos_ups_billdata'), metadata,
|
||||
Column('sale_date', DateTime, nullable=False),
|
||||
Column('shop_name', String(100), nullable=False),
|
||||
Column('pos_no', Integer, nullable=False),
|
||||
Column('bill_no', Integer, nullable=False),
|
||||
Column('pos_no', String(20), nullable=False),
|
||||
Column('bill_no', String(20), nullable=False),
|
||||
Column('product_cd', String(20), nullable=False),
|
||||
Column('ca01', String(50)),
|
||||
Column('ca02', String(50)),
|
||||
@ -235,9 +235,18 @@ pos_ups_billdata = Table(
|
||||
Column('vat_amt', Integer),
|
||||
Column('cash_receipt', Integer),
|
||||
Column('card', Integer),
|
||||
PrimaryKeyConstraint('sale_date', 'shop_name', 'pos_no', 'bill_no', 'product_cd')
|
||||
# PrimaryKeyConstraint 생략
|
||||
|
||||
mysql_engine='InnoDB',
|
||||
mysql_charset='utf8mb4'
|
||||
)
|
||||
|
||||
# 인덱스 추가
|
||||
Index('idx_sale_shop_pos_product', pos_ups_billdata.c.sale_date, pos_ups_billdata.c.shop_name, pos_ups_billdata.c.pos_no, pos_ups_billdata.c.product_cd)
|
||||
Index('idx_category', pos_ups_billdata.c.ca01, pos_ups_billdata.c.ca02, pos_ups_billdata.c.ca03)
|
||||
Index('idx_product_barcode', pos_ups_billdata.c.product_name, pos_ups_billdata.c.barcode)
|
||||
|
||||
|
||||
pos_shop_name = Table(
|
||||
get_full_table_name('pos_shop_name'), metadata,
|
||||
Column('shop_cd', String(20), primary_key=True, nullable=False),
|
||||
|
||||
Reference in New Issue
Block a user