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
Copy file name to clipboardExpand all lines: docs/cloud/features/scheduler/scheduler.md
+55-1Lines changed: 55 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -167,4 +167,58 @@ Tobiko Cloud automatically manages Python dependencies of your Python macros and
167
167
168
168
SQLMesh automatically infers which Python libraries are used by statically analyzing the code of your models and macros.
169
169
170
-
For fine-grained control, dependencies can be specified, pinned, or excluded using the `sqlmesh-requirements.lock` file. See the [Python library dependencies](../../../guides/configuration.md#python-library-dependencies) section in the SQLMesh configuration guide for more information.
170
+
For fine-grained control, dependencies can be specified, pinned, or excluded using the `sqlmesh-requirements.lock` file. See the [Python library dependencies](../../../guides/configuration.md#python-library-dependencies) section in the SQLMesh configuration guide for more information.
171
+
172
+
## Secrets
173
+
174
+
Tobiko Cloud provides a way for you to provide environment variables that will
175
+
be injected into the environment when running your python models.
176
+
177
+
In your cloud instance you can find Secrets under the Settings section and will
178
+
look like this:
179
+
180
+

181
+
182
+
In this example, only one secret has been defined: `MY_SECRET`. From this panel
183
+
you can create a new secret, edit the value of your secrets, or remove them. You
184
+
can not view the value of any previously created secret.
185
+
186
+
Secret names must start with a letter or an underscore. They may only include
187
+
letters, numbers and underscores (no spaces or other symbols). There are no
188
+
limits or restrictions on the value of secrets. We recommend base64 encoding
189
+
secrets if they contain binary data.
190
+
191
+
### Example Secret Use
192
+
193
+
```python
194
+
import os
195
+
import typing as t
196
+
from datetime import datetime
197
+
198
+
from sqlmesh import ExecutionContext, model
199
+
200
+
@model(
201
+
"my_model.name",
202
+
columns={
203
+
"column_name": "int",
204
+
},
205
+
)
206
+
defexecute(
207
+
context: ExecutionContext,
208
+
start: datetime,
209
+
end: datetime,
210
+
execution_time: datetime,
211
+
**kwargs: t.Any,
212
+
) -> pd.DataFrame:
213
+
214
+
# Read a secret from the MY_SECRET environment variable
215
+
my_secret = os.environ["MY_SECRET"]
216
+
```
217
+
218
+
!!! warning "Protecting Secrets"
219
+
220
+
It's very important that you read environment variables from inside the models
221
+
`execute` function and not in the global scope. If the variable is loaded in the
222
+
global scope than the value will be read from your local system and saved
223
+
into the rendered version of this model, instead of loaded at runtime on our
0 commit comments