Skip to content

Snowflake

dadosfera.services.snowflake.get_snowpark_session

get_snowpark_session(secret_id)
Source code in dadosfera/services/snowflake.py
76
77
78
def get_snowpark_session(secret_id):
    connection_parameters = _get_connection_parameters(secret_id)
    return Session.builder.configs(connection_parameters).create()

dadosfera.services.snowflake.get_snowflake_connector_session

get_snowflake_connector_session(secret_id)
Source code in dadosfera/services/snowflake.py
80
81
82
83
def get_snowflake_connector_session(secret_id):
    connection_parameters = _get_connection_parameters(secret_id)
    conn = snowflake.connector.connect(**connection_parameters)
    return conn.cursor()

dadosfera.services.snowflake.fetch_data_as_df

fetch_data_as_df(cursor, query)
Source code in dadosfera/services/snowflake.py
85
86
87
88
89
def fetch_data_as_df(cursor, query):
    cursor.execute(query)
    data_list = cursor.fetchall()
    column_names = [description[0] for description in cursor.description]
    return pd.DataFrame(data_list, columns=column_names)