Impact 2024: The Industrial Data and AI Conference for and by Users | Nominate Speakers Now for a Ch...
To get environment specific secrets you could create them as a GitHub secret and concatenate the CDF project name to the secret name.If you have cdf-project-a and cdf-project-b create two secrets in GitHub;SOME_SECRET_CDF_PROJECT_A and SOME_SECRET_CDF_PROJECT_B In config.yaml for your function add a list of secrets under modelSettings/secrets:modelSettings:... secrets: - SOME_SECRET_CDF_PROJECT_A - SOME_SECRET_CDF_PROJECT_BIn you handler.py:def handle(client, data, secrets): print(f"Hello world from Cognite Functions @ {datetime.now()}!") some_secret = secrets[f"some-secret-{client.config.project}"] # use secretThe token used against CDF can be fetched using client.config.token(). Please notice that the scope is CDF specific and might not work againt a 3rd party service requiring a different scope.
You shouldn’t add _SECRET unless you also update the code. In any case it will be too long so it could be worked around by creating a map in the handler.py:Create secrets in config.yaml+GitHub- COUNT_API_PROD, COUNT_API_TESTIn handler.py:secret_map = {"count-api-accenture-operations-twin":"count-api-prod"}def handle(client, data, secrets): print(f"Hello world from Cognite Functions @ {datetime.now()}!") some_secret = secrets[secret_map[f"some-secret-{client.config.project}"]] # use secret
Your code it correct, the token will be in the result from app.acquire_token_for_clientComplete code:import msalapp = msal.ConfidentialClientApplication( client_id="<client id>", authority="https://login.microsoftonline.com/<tenantid>", client_credential="<secret>" )result = app.acquire_token_for_client(scopes=["<scope>"])token = result['access_token']
No. You will only get the token from the client. You can name it with shorter name and use the mapping described in my previous answer.
HiI’m not sure if it solves your problem, but you should remove the “cognite-sdk-core” package. With SDK >v4 it was removed so it might cause issues to have both packages installed.Are you running the code behind a firewall/proxy?
Can you share more of the stacktrace? Does it still work?
Hello,The Cognite Grafana plugin doesn’t do cursor API queries basically due to user friendliness and performance.Assuming this is about the variables created with asset queries; A dropdown with >1000 items will be very hard to navigate. Having more items will also make it slow. Is it possible to filter the assets to make the list of assets shorter? Displaying more than 1000 timeseries in one small widget will be hard to read and take time to calculate (slow). Does it make sense from the user’s perspective? We recommend splitting the time series into multiple widgets.
There is a limit on synthetic time series as well, so even though if the Grafana plugin would fetch >1000 time series to do the average over it would not work with your current design.avg(ts{assetSubtreeIds=xxx})https://docs.cognite.com/dev/concepts/resource_types/synthetic_timeseries/In a single request, you can ask for:10 expressions (10 synthetic time series). 10.000 data points, summed over all expressions. 100 input time series referrals, summed over all expressions. 2000 tokens in each expression. Similar to 2000 characters, except that words and numbers are counted as a single character.You will reach multiple of these limitations.The current recommendation is to create a Cognite Function that creates the average across the subtree and write the result to a new time series you can visualize in Grafana.In addition, we could move your current request into a feature request.
It seems to be related to flake moving from gitlab to github.https://www.reddit.com/r/Python/comments/yvfww8/flake8_took_down_the_gitlab_repository_in_favor/I will update the pre-commit in your repo to see if it helps. It’s not related to being a personal repo.
I have created https://github.com/cogniteAIR/accenture-cpg-demo-2 and pushed the code to that repo and invited you as admin. You need to invite rdhande1992 and ash him to add the same secrets to this new repo.
Looking at your scopes parameter it’s a bit wrong, it should only contain .default and not user_impersonation:scopes=[f"{cognite_base_url}/.default"]
When using synthetic time series you can do a mapping from string to a number to get out results, this might help your use case:Map the strings OPEN → 1 and CLOSED → 0map(TS{externalId='stringstate'}, ['OPEN', 'CLOSED'], [1, 0], -1)Doc: https://docs.cognite.com/dev/concepts/resource_types/synthetic_timeseries/#convert-string-time-series-to-doubles
You have done it correctly, but as you see from the popup PowerBI has to be approved by the AzureAD admin.You can contact @niladrimondal for some more information on how to get that done internally in Accenture.
There will be added another for PowerBI (this is a microsoft app) once it is approved. See the documentation link provided above. It needs to be approved by an accenture.com AAD admin.
Azure Managed grafana does not include the Cognite Data Fusion data source. It only has a limited set of data sournce plugins which has been whitelisted by Microsoft.We have requested to get the CDF data source whitelisted, but it has not yet been done by Microsoft.If you want to try out grafana you could also try the free tier at grafana.com which many of our customers are using.
https://grafana.com/pricing/
We haven’t tested that Azure application. Is the cognite datasource available there or not?
This setup is not supported by our pipeline action. It will build the zip file and create the function in the same codebase.What’s the value of doing it with a single zip file? The contents of the zip file will the same when ran on the same source code.
Can you also share the code and your requirements.txt?
Hi, this isn’t possible since there is no fixed columns in a RAW table. You can have different columns per row.
It’s not implemented in the python SDK yet, it has not been a need (most customers only have 1-2 projects).You can however use it in the python SDK with generic get function against the REST-API:client.get("/api/v1/projects")
Hi - is this happening with AzureAD or Sauth?
When is this happening? This is Sauth specific, it seems Sauth is doing rate limiting. We haven’t experienced this error with Azure AD.
In RAW, all columns are stored as a string.
If you initialise the client Sauth will be called. The name is just used for reporting purposes in the API. If you initialise only at the start Sauth will only be called when the token needs a refresh (after one hour). The error you pasted above is not related to Sauth, it seems to have been a small hickup on the API side. You could try to tune the retry settings in this SDK using client.config.GlobalConfig:https://cognite-sdk-python.readthedocs-hosted.com/en/latest/cognite_client.html#cognite.client.config.GlobalConfig.max_retries_connect
Already have an account? Login
Enter your username or e-mail address. We'll send you an e-mail with instructions to reset your password.
Sorry, we're still checking this file's contents to make sure it's safe to download. Please try again in a few minutes.
Sorry, our virus scanner detected that this file isn't safe to download.