You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
First, provision an OAuth Client for Airflow to use by following the guide on how to [provision client credentials](../single_sign_on.md#provisioning-client-credentials).
56
+
57
+
After provisioning the credentials, you can obtain the `Client ID` and `Client Secret` values for Airflow to use to connect to Tobiko Cloud.
58
+
55
59
Next, add an Airflow [connection](https://airflow.apache.org/docs/apache-airflow/stable/howto/connection.html#creating-a-connection-with-the-ui) containing your Tobiko Cloud credentials.
56
60
57
61
Specify these fields when adding the connection:
@@ -60,9 +64,8 @@ Specify these fields when adding the connection:
60
64
- May not contain spaces, single quotes `'`, or double quotes `"`
61
65
-**Connection Type**: always HTTP
62
66
-**Host**: URL for your Tobiko Cloud project
63
-
-**Password**: your Tobiko Cloud API token
64
-
65
-
The host URL and password values will be provided to you during your Tobiko Cloud onboarding.
67
+
-**Login**: OAuth `Client ID` for Airflow
68
+
-**Password**: OAuth `Client Secret` for Airflow
66
69
67
70
It is convenient to specify the connection in the Airflow UI, as in this example with the name `tobiko_cloud`:
On this page, we demonstrate the secrets method Dagster recommends for **local development**.
59
59
60
-
In your Dagster project, create an `.env` file if it does not already exist. Next, specify environment variables containing the Tobiko Cloud URL and token secrets:
60
+
First, provision an OAuth Client for Dagster to use by following the guide on how to [provision client credentials](../single_sign_on.md#provisioning-client-credentials).
61
+
62
+
After provisioning the credentials, you can obtain the `Client ID` and `Client Secret` values for Dagster to use to connect to Tobiko Cloud.
63
+
64
+
In your Dagster project, create an `.env` file if it does not already exist. Next, specify environment variables containing the Tobiko Cloud URL and OAuth secrets:
61
65
62
66
```sh title=".env"
63
-
TOBIKO_CLOUD_BASE_URL=<URL for your Tobiko Cloud project># ex: https://cloud.tobikodata.com/sqlmesh/tobiko/public-demo/
64
-
TOBIKO_CLOUD_TOKEN=<your Tobiko Cloud API token># ex: 'ioawjioefja1'
67
+
TCLOUD_BASE_URL=<URL for your Tobiko Cloud project># ex: https://cloud.tobikodata.com/sqlmesh/tobiko/public-demo/
68
+
TCLOUD_CLIENT_ID=<your OAuth Client ID for Dagster># ex: '5ad2938d-e607-489a-8bec-bdfb5924b79b'
69
+
TCLOUD_CLIENT_SECRET=<your OAuth Client Secret for Dagster># ex: 'psohFoOcgweYnbx-bmYn3XXRDSNIP'
65
70
```
66
71
67
-
Your Solutions Architect will provide the base URL and token values during your Tobiko Cloud onboarding.
68
-
69
72
### Create Dagster objects
70
73
71
74
You are now ready to create Dagster objects connected to Tobiko Cloud.
@@ -84,8 +87,9 @@ from dagster import EnvVar # for accessing variables in .env file
84
87
85
88
# create and configure SQLMeshEnterpriseDagster instance named `sqlmesh`
86
89
sqlmesh = SQLMeshEnterpriseDagster(
87
-
url=EnvVar("TOBIKO_CLOUD_BASE_URL").get_value(), # environment variable from .env file
88
-
token=EnvVar("TOBIKO_CLOUD_TOKEN").get_value(), # environment variable from .env file
90
+
url=EnvVar("TCLOUD_BASE_URL").get_value(), # environment variable from .env file
91
+
oauth_client_id=EnvVar("TCLOUD_CLIENT_ID").get_value(), # environment variable from .env file
92
+
oauth_client_secret=EnvVar("TCLOUD_CLIENT_SECRET").get_value(), # environment variable from .env file
89
93
)
90
94
91
95
# create Definitions object with `sqlmesh` object's `create_definitions()` method
@@ -186,8 +190,8 @@ Specifically, we must use Dagster's GraphQL API, which is not enabled by default
|`url`| The Base URL to your Tobiko Cloud instance | str | Y |
373
-
|`token`| Your Tobiko Cloud API Token | str | N |
377
+
|`oauth_client_id`| OAuth Client ID of the credentials you [provisioned](../single_sign_on.md#provisioning-client-credentials) for Dagster | str | N |
378
+
|`oauth_client_secret`| OAuth Client Secret of the credentials you [provisioned](../single_sign_on.md#provisioning-client-credentials) for Dagster | str | N |
374
379
|`dagster_graphql_host`| Hostname of the Dagster Webserver GraphQL endpoint | str | N |
375
380
|`dagster_graphql_port`| Port of the Dagster Webserver GraphQL endpoint | int | N |
376
381
|`dagster_graphql_kwargs`| Extra args to pass to the [DagsterGraphQLClient](https://docs.dagster.io/api/python-api/libraries/dagster-graphql#dagster_graphql.DagsterGraphQLClient) class when it is instantiated | dict | N |
Otherwise, you will be logged out automatically when the SSO session expires (every 24 hours).
196
+
197
+
## OAuth Clients
198
+
199
+
Sometimes, you want to grant an external service access to your Tobiko Cloud project. For example, the external service could be the [CICD bot](../../integrations/github.md) or a [scheduler integration](./scheduler/airflow.md).
200
+
201
+
These services take `Client ID` and `Client Secret` credentials.
202
+
203
+
!!! Info "One set of credentials per service"
204
+
It's best practice to provision a separate set of credentials for each service that you wish to connect to Tobiko Cloud. This gives you the flexibility to revoke credentials for a specific service without affecting access for other services.
205
+
206
+
### Provisioning client credentials
207
+
208
+
To provision OAuth credentials for a new service, browse to `Settings -> OAuth Clients` in the lefthand navigation menu.
209
+
210
+
In the page's Create new Client section, enter a client name and human readable description:
211
+
212
+

213
+
214
+
Once you click `Save`, the client will be added to the list:
0 commit comments