DROP TABLE IF EXISTS d_mdl_vpc_disc.MM_NUEVOS_MES_AGENDA
CREATE TABLE d_mdl_vpc_disc.MM_NUEVOS_MES_AGENDA
WITH ( format = 'Parquet',
         parquet_compression = 'SNAPPY',
         partitioned_by = ARRAY['p_periodo'],
         external_location= 's3://sagemaker-us-east-1-058528764918/vpc/propension/athena/MM_NUEVOS_MES_AGENDA/'
       )
AS (
    SELECT AG.*,
           B.flg_contacto_efectivo_1m,
           B.flg_gestionado_1m,
           B.flg_lo_pensara_creditos_nuevos_1m,
           AG.periodo_val p_periodo
    FROM d_mdl_vpc_disc.HM_NUEVO_MES_AGENDA_CREDITOS_CAMPANIAS AG
    LEFT JOIN d_mdl_vpc_disc.mm_barrido_agenda B
    ON AG.num_doc = B.num_doc
)

Add a code snippet to your website: www.paste.org