CurrentRun.conn is used to access the connectors that are passed into the PrismProject's instantiation.
Here is the full method definition:
CurrentRun.conn(self, connector_id: str) -> Connector:""" Get the connector object associated with ID `connector_id`. These are defined in the client's instantiation. args: connector_id: ID of task from which to retrieve output returns: connector object associated with `connector_id` raises: prism.exception.ConnectorDoesNotExistException if the connector ID is not found """
This is largely a utility method designed to make your life easier. You could just as easily define your connector within the task itself.
Tasks within this project can call the SnowflakeConnector instance as follows:
# example_project/tasks/extract_from_snowflake.pyfrom prism.decorators import taskfrom prism.runtime import CurrentRun@task()defextract_from_snowflake(): conn = CurrentRun.conn(connector_id="snowflake-connector") # the same connector ID that was used for the Connector object
df = conn.execute_sql(..., return_type="pandas")return df
Note that the connector_id argument value is same ID used when creating the SnowflakeConnector instance.