Exemplo n.º 1
0
			MAX(ps.CODIGO_BARRA) as ean
		FROM produtos_barra ps
		LEFT JOIN dbo.W_ESTOQUE_DISPONIVEL_SKU e on e.codigo_barra = ps.CODIGO_BARRA
		where e.estoque_disponivel > 0
			-- and ps.produto = '23.11.0244'
			-- and ps.COR_PRODUTO = '32'
		group by ps.produto, ps.COR_PRODUTO-- , LEFT(ps.CODIGO_BARRA, LEN(ps.CODIGO_BARRA)-LEN(ps.grade))
		;
	"""

    skus_for_image = dc.select(skus_for_image, strip=True, dict_format=True)

    # images = []
    # for sku in skus_for_image:
    # 	images.append(get_image_url(sku))

    with Pool(50) as p:
        images = p.map(get_image_url, skus_for_image)

    images = [x for x in images if x]

    # brute-force remove repeated images
    images = list(set(images))

    dc = DatabaseConnection()
    print('Inserting into tables...')

    print('	bi_sku_images')
    dc.execute('TRUNCATE TABLE bi_sku_images;')
    dc.insert('bi_sku_images', images, print_only=False)
Exemplo n.º 2
0
 product_columns = [
     'PRODUTO', 'DESC_PRODUTO', 'GRUPO_PRODUTO', 'SUBGRUPO_PRODUTO',
     'FATOR_OPERACOES', 'CLASSIF_FISCAL', 'TIPO_PRODUTO', 'COLECAO',
     'GRADE', 'DESC_PROD_NF', 'LINHA', 'GRIFFE', 'UNIDADE', 'REVENDA',
     'REFER_FABRICANTE', 'FABRICANTE', 'PONTEIRO_PRECO_TAM', 'TRIBUT_ICMS',
     'TRIBUT_ORIGEM', 'DATA_REPOSICAO', 'TAMANHO_BASE', 'ENVIA_LOJA_VAREJO',
     'TAXA_JUROS_DEFLACIONAR', 'DATA_CADASTRAMENTO', 'STATUS_PRODUTO',
     'TIPO_STATUS_PRODUTO', 'EMPRESA', 'CONTA_CONTABIL', 'INDICADOR_CFOP',
     'QUALIDADE', 'CONTA_CONTABIL_COMPRA', 'CONTA_CONTABIL_VENDA',
     'CONTA_CONTABIL_DEV_COMPRA', 'CONTA_CONTABIL_DEV_VENDA',
     'COD_CATEGORIA', 'COD_SUBCATEGORIA', 'PERC_COMISSAO',
     'ACEITA_ENCOMENDA', 'DIAS_GARANTIA_LOJA', 'DIAS_GARANTIA_FABRICANTE',
     'TIPO_ITEM_SPED', 'POSSUI_GTIN', 'TITULO_B2C', 'SEXO_TIPO'
 ]
 dc.insert('PRODUTOS',
           product_insert_query_values_list,
           columns=product_columns,
           print_only=PRINT_ONLY)
 product_color_columns = [
     'PRODUTO', 'COR_PRODUTO', 'DESC_COR_PRODUTO', 'INICIO_VENDAS',
     'FIM_VENDAS', 'COR_SORTIDA', 'STATUS_VENDA_ATUAL', 'COR',
     'CUSTO_REPOSICAO1', 'PRECO_REPOSICAO_1', 'PRECO_A_VISTA_REPOSICAO_1',
     'CLASSIF_FISCAL', 'TRIBUT_ORIGEM'
 ]
 dc.insert('PRODUTO_CORES',
           product_color_insert_query_values_list,
           columns=product_color_columns,
           print_only=PRINT_ONLY)
 product_price_columns = [
     'PRODUTO', 'CODIGO_TAB_PRECO', 'PRECO1', 'ULT_ATUALIZACAO',
     'PRECO_LIQUIDO1', 'PRECO_LIQUIDO2', 'PRECO_LIQUIDO3', 'PRECO_LIQUIDO4',
     'PROMOCAO_DESCONTO'
Exemplo n.º 3
0
    # Multi Threading:
    with Pool(20) as p:
        result = p.map(get_product_info, product_ref_ids)

    for result_thread in result:
        for key in product_info:
            product_info[key].extend(result_thread[key])

    print('Done!')

    print('Inserting into tables...')

    print('	bi_vtex_product_items')
    dc.execute('TRUNCATE TABLE bi_vtex_product_items;')
    dc.insert('bi_vtex_product_items', product_info["product_items"])

    print('	bi_vtex_products')
    dc.execute('TRUNCATE TABLE bi_vtex_products;')
    dc.insert('bi_vtex_products', product_info["products"])

    print('	bi_vtex_product_categories')
    dc.execute('TRUNCATE TABLE bi_vtex_product_categories;')
    dc.insert('bi_vtex_product_categories', product_info["product_categories"])

    print('	bi_vtex_product_item_images')
    dc.execute('TRUNCATE TABLE bi_vtex_product_item_images;')
    dc.insert('bi_vtex_product_item_images', product_info["product_images"])

    print('Done!')