def get_table_row_count(**context): table_row_count = MEDICARE_PART_D_PROVIDER_OFF_SET_START print("Counting TABLE MAX Row ...") dwh_hook = SnowflakeHook(snowflake_conn_id="kyu_snowflake_conn", warehouse="COMPUTE_WH") table_row_count = dwh_hook.get_first(table_row_count)[0] print("OFF_SET_START: " + str(table_row_count))
def get_table_max_incremental_number(**context): get_table_max_incremental_number = MEDICARE_PART_D_PROVIDER_TABLE_MAX_NPI print("Get Table MAX increment number...") dwh_hook = SnowflakeHook(snowflake_conn_id="kyu_snowflake_conn", warehouse="COMPUTE_WH") dwh_hook.run(get_table_max_incremental_number, autocommit=True) table_max_npi = dwh_hook.get_first(get_table_max_incremental_number)[0] print("MAX Table increment number: " + str(table_max_npi))
def insert_row(timestamp, **context): pprint(context) dwh_hook = SnowflakeHook(snowflake_conn_id="snowflake_conn") result = dwh_hook.get_first( "insert into public.test_table_time select 'INSERT', " + timestamp + ", parse_json(' " + context + " ');") logging.info("Added row with timestamp : %s, and result is $s", timestamp, result)
def row_count(**context): dwh_hook = SnowflakeHook(snowflake_conn_id="snowflake_all") result = dwh_hook.get_first("select count(*) from public.tapas") logging.info("Number of rows in `public.tapas` - %s", result[0])
def get_row_count(**context): dwh_hook = SnowflakeHook(snowflake_conn_id="snowflake_common") result = dwh_hook.get_first( "select count(*) from private.{}".format(table_name)) logging.info("Number of rows in `private.%s` - %s", table_name, result[0])
def row_count(**context): dwh_hook = SnowflakeHook(snowflake_conn_id="snowflake_sql") result = dwh_hook.get_first("select count(*) from public.stage_status") print("Number of rows in `public.test_table` - %s", result[0])