versão com novo banco de dados
This commit is contained in:
parent
b2fb8fd8e3
commit
ed940251e2
@ -1,6 +1,6 @@
|
||||
import smtplib
|
||||
import ssl
|
||||
import psycopg2
|
||||
import pyodbc
|
||||
import configparser
|
||||
import numpy as np
|
||||
import pandas as pd
|
||||
@ -16,12 +16,12 @@ from email.mime.image import MIMEImage
|
||||
config = configparser.ConfigParser()
|
||||
config.read(r"C:\Users\joao.herculano\Documents\Enviador de email\credenciais.ini")
|
||||
|
||||
conn = psycopg2.connect(
|
||||
host=config['banco']['host'],
|
||||
port="5432",
|
||||
database="ginseng",
|
||||
user=config['banco']['user'],
|
||||
password=config['banco']['password']
|
||||
conn = pyodbc.connect(
|
||||
f"DRIVER={{SQL Server}};"
|
||||
f"SERVER={config['banco']['host']},1433;"
|
||||
f"DATABASE=GINSENG;"
|
||||
f"UID={config['banco']['user']};"
|
||||
f"PWD={config['banco']['password']}"
|
||||
)
|
||||
|
||||
calendario = pd.read_excel(r"C:\Users\joao.herculano\GRUPO GINSENG\Assistência Suprimentos - 2025\SUPRIMENTOS\BD_LANÇAMENTOS\BASE DE DADOS LANÇAMENTO\BOT\CICLO 9\CALENDARIO_CICLO\Ciclo_Expandido_com_Datas.xlsx")
|
||||
@ -45,14 +45,14 @@ SELECT
|
||||
code AS sku,
|
||||
description AS descricao_produto,
|
||||
salescurve AS curva,
|
||||
CASE WHEN promotions_description = '' THEN 'REGULAR' ELSE 'PROMOÇÃO' END AS tipo_promocao,
|
||||
CASE WHEN promotions_description IS NULL THEN 'REGULAR' ELSE 'PROMOÇÃO' END AS tipo_promocao,
|
||||
COALESCE(stock_actual, 0) AS estoque,
|
||||
stock_intransit AS transito,
|
||||
nextcycleprojection AS pv_mar,
|
||||
currentcyclesales AS venda_atual,
|
||||
CASE WHEN criticalitem_iscritical = false THEN 'REGULAR' ELSE 'CRITICO' END AS status_item
|
||||
CASE WHEN criticalitem_iscritical = 0 THEN 'REGULAR' ELSE 'CRITICO' END AS status_item
|
||||
FROM Draft
|
||||
WHERE isproductdeactivated = false AND codcategory NOT IN ('SUPORTE A VENDA','EMBALAGENS')
|
||||
WHERE isproductdeactivated = 0 AND codcategory NOT IN ('SUPORTE A VENDA','EMBALAGENS')
|
||||
'''
|
||||
df = pd.read_sql(query, conn)
|
||||
conn.close()
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user