prefect_monte_carlo.credentials
Credential classes used to perform authenticated interactions with Monte Carlo
Classes
MonteCarloCredentials
Bases: Block
Block used to manage Monte Carlo authentication.
Attributes:
Name | Type | Description |
---|---|---|
api_key |
SecretStr
|
The Monte Carlo API key to authenticate with. |
api_key_id |
str
|
The Monte Carlo API key ID to authenticate with. |
catalog_url |
Optional[str]
|
The URL of the Monte Carlo catalog to use. |
Example
Load stored Monte Carlo credentials:
from prefect_monte_carlo.credentials import MonteCarloCredentials
montecarlo_credentials_block = MonteCarloCredentials.load("BLOCK_NAME")
Source code in prefect_monte_carlo/credentials.py
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 |
|
Functions
get_client
Gets an authenticated Monte Carlo GraphQL client via pycarlo.
Returns:
Type | Description |
---|---|
Client
|
An authenticated Monte Carlo GraphQL client. |
Example
Gets an authenticated Monte Carlo GraphQL client.
from prefect import flow
from prefect_monte_carlo.graphql import execute_graphql_operation
from prefect_monte_carlo.credentials import MonteCarloCredentials
@flow
def example_execute_query():
monte_carlo_credentials = MonteCarloCredentials.load(
"my-montecarlo-credentials"
)
result = execute_graphql_operation(
monte_carlo_credentials=monte_carlo_credentials,
query="query getUser { getUser { email firstName lastName }}",
)
example_execute_query()
Source code in prefect_monte_carlo/credentials.py
54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 |
|