Code Repositories Local Development

Hello Community!

I’m exploring ways to enhance my development workflow with Code Repositories, and I was wondering if there’s a method to work locally in Foundry, similar to how one might develop using Snowpark. Specifically, I’d like to connect to Snowflake from my local environment and run code on demand. I can see now that there is an available feature to clone the repo to a local environment, but still I can’t stablish the Spark session.

For example, in a Snowpark environment, I can do something like this:

from snowflake.snowpark import Session, functions as F, types as T, Window

def create_snowflake_session():
    connection_parameters = {
        "account": os.getenv('ACCOUNT'),
        "user": os.getenv('USERNAME'),
        "password": os.getenv('PASSWORD'),
        "role": os.getenv('ROLE'),
        "warehouse": os.getenv('WAREHOUSE')
    }

    session = Session.builder.configs(connection_parameters).create()
    return session

session = create_snowflake_session()

table = session.read.table('DB.SCHEMA.TABLE')
table.show()

Is there a way to achieve something similar within the Foundry ecosystem, allowing for local development with a connection to the Foundry runners? Any guidance or best practices would be greatly appreciated!

Thanks in advance!

Did you checkout Foundry DevTools?

https://emdgroup.github.io/foundry-dev-tools/

We re-implemented the transforms API a while ago and made it open source.

You could clone your repository, create a Python environment and install foundry-dev-tools-transforms on top.

More is in the docs here:

https://emdgroup.github.io/foundry-dev-tools/getting_started/transforms.html

This will execute the code on your local machine. If you want to execute it within Foundey but have the code running locally there is a basic feature available and described in the docs here:

https://palantir.com/docs/foundry/transforms-common/local-preview/

I know that the team @jayad is working on a VSCode extension that will make this workflow much smoother.

Hi @Luis_Felipe_Trindade

Palantir already offers embedded VS code in Code Repositories.

It is behind the feature flag. We have been experimenting with it, and are quite satisfied.