att
This commit is contained in:
parent
61f95e34db
commit
4a829b5112
@ -62,7 +62,7 @@ def get_token():
|
||||
def insert_items_to_db(cursor, items):
|
||||
"""Insere uma lista de itens no banco de dados"""
|
||||
insert_query = """
|
||||
INSERT INTO [dbo].[rgb_product_new] (
|
||||
INSERT INTO [dbo].[rgb_product] (
|
||||
[sku], [marketId], [tacticId], [strategicId], [brand], [internalCode],
|
||||
[description], [discontinued], [purpose], [discountAllowed], [maxDiscount],
|
||||
[createdAt], [discontinuedDate], [updatedAt], [ncmId], [cest],
|
||||
@ -239,7 +239,7 @@ def fetch_and_insert_all_products(token):
|
||||
# A coluna updatedAt está no formato: 2025-10-26 11:38:46.0000000 -03:00
|
||||
# Usamos CAST para comparar apenas a parte da data
|
||||
check_query = """
|
||||
SELECT COUNT(*) FROM [dbo].[rgb_product_new]
|
||||
SELECT COUNT(*) FROM [dbo].[rgb_product]
|
||||
WHERE CAST([updatedAt] AS DATE) = ?
|
||||
"""
|
||||
cursor.execute(check_query, yesterday)
|
||||
@ -248,7 +248,7 @@ def fetch_and_insert_all_products(token):
|
||||
if existing_count > 0:
|
||||
print(f" ⚠ Encontrados {existing_count} registros para {yesterday}. Deletando...")
|
||||
delete_query = """
|
||||
DELETE FROM [dbo].[rgb_product_new]
|
||||
DELETE FROM [dbo].[rgb_product]
|
||||
WHERE CAST([updatedAt] AS DATE) = ?
|
||||
"""
|
||||
cursor.execute(delete_query, yesterday)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user