Links
👩💻

Python SDK

Prefer python to a UI? You're in the right place.

1. Create an Account or Login to Rasgo

Head over to https://app.rasgoml.com/ to signup and get an API key.
Once your account is confirmed and you have logged in, you can copy your API key by clicking 'API KEY' in the top-right corner any page in the Rasgo UI. This will copy the key to your clipboard.

2. Install PyRasgo

Use pip to install PyRasgo:
Snowflake
BigQuery
pip install "pyrasgo[snowflake]"
pip install "pyrasgo[bigquery]"
Then, authenticate with your API key:
Snowflake (default)
BigQuery
!pip install "pyrasgo[snowflake]"
import pyrasgo
api_key = '' #paste your API key here from the UI
rasgo = pyrasgo.connect(api_key)
!pip install "pyrasgo[bigquery]"
import pyrasgo
api_key = '' #paste your API key here from the UI
rasgo = pyrasgo.connect(api_key)

3. Register a Dataset

To register a new dataset with Rasgo, you have 2 options:
Pandas Dataframe
DataWarehouse Table
To publish a pandas dataframe, use:
rasgo.publish.df(df=df, name='my dataset')
Please refer to the documentation for additional details.
To publish a Snowflake table, use:
rasgo.publish.table(fqtn='DATABASE.SCHEMA.TABLE')

4. Transform your Dataset

You can apply transformations to Rasgo Dataset objects, like this:
datasets = rasgo.get.datasets()
print(datasets)
internet_sales = rasgo.get.dataset(74)
ds2 = internet_sales.aggregate(
group_by=['PRODUCTKEY'],
aggregations={'SALESAMOUNT':['AVG', 'SUM'],
'TOTALPRODUCTCOST':['AVG']})
Rasgo Transforms can be previewed and chained together, like this:
ds2.preview()
ds3 = ds2.one_hot_encode(column='PRODUCTKEY')
ds3.preview()
The result of your Rasgo Transforms can be published back to Rasgo using:
new_ds = rasgo.publish.dataset(dataset=ds3, name='Product Sales Analysis')
When a new Dataset is published, Rasgo stores the SQL operations created by using Rasgo Transforms in your data warehouse, so that the new dataset is stored alongside the original data.
Once published, the Dataset is also accessible via the Rasgo UI for visualization and collaboration.