[Python] python script to fetch data from oracle

Discussão em 'Python' iniciado por Stack, Agosto 17, 2025.

  1. Stack

    Stack Membro Participativo

    i am new to python and i have below requirement.

    i have 5 tables which i need to fetch from oracle from same db daily. insert into snowflake tables .the job should run on hourly basis.

    i have two text files , one is maping text file which shows correspondence oracle-snowflake table mapping, the another text files which should have last insert date for each snowflake tables.

    mapping text file:

    oracle snowflake
    or_tbl_v1 snw_tbl_v1
    or_tbl_v2 snw_tbl_v2
    or_tbl_v3 snw_tbl_v3
    or_tbl_v4 snw_tbl_v4
    or_tbl_v5 snw_tbl_v5


    text file that shows last max date the record is inserted for each table.

    table date
    snw_tbl_v1 2025-08-17 12:33:44 55:66:00
    snw_tbl_v2 2025-08-17 12:33:44 56:66:00
    snw_tbl_v3 2025-08-17 12:33:44 57:66:00
    snw_tbl_v4 2025-08-17 12:33:44 58:66:00
    snw_tbl_v5 2025-08-17 12:33:44 59:66:00


    so every hour when the job runs it should update above text file with max date from table based on the column insert_date. and then it should pick the date from oracle which is max then the file date for each table. and insert into snowflake table from that date.

    oracle : select max(date) from table (oracle) where date > select date from table(snoflake) --- it should come from file . query : insert into snowflake.table select * from oracle where date >= maxdate) from above query.

    thanks

    Continue reading...

Compartilhe esta Página