BigQuery How to past json authentication file content to secret

thanks for the invite and making secret available

I am trying to connect to BigQuery I have the service account json, but when I copy and past the values in the secret it gave me errors later when I deploy the app, is there a documentation how to do that

Hey @mim,

First, welcome to the Streamlit Community! :star_struck: :partying_face: :tada: :partying_face: :star2: :star_struck:

I checked in with our team and they know that we are a bit light on examples for this! They are actually making up an app example for just this application of secrets (connecting to BigQuery) and that will be ready soon.

Edit: sorry forgot to add this in, we are still working on making the Docs live but for now check out this link for details: Notion – The all-in-one workspace for your notes, tasks, wikis, and databases.

As soon as they pass that on I will link it here for you!

Happy Streamlit-ing!
Marisa

Hey @mim,

you really had perfect timing, we were just starting to put together examples for database connections this week :wink: Here’s a step by step guide for how to connect Streamlit to BigQuery: Notion – The all-in-one workspace for your notes, tasks, wikis, and databases.

Please let us know if this works for you or if anything is off – this document is very new and any feedback is highly appreciated!!

Cheers, Johannes

1 Like

Thanks @jrieke! :heart_eyes:

Perfect, it is working thanks a lot !!!

1 Like

I am quite irritated by this instruction:

In the root of your Streamlit app, create a file .streamlit/secrets.toml

That would mean that this file with the secrets ends up in the public github repo? :flushed:
Unless you exclude it in the .gitignore - but then it has no use for streamlit sharing anymore.
I’m confused - or did I miss something? :thinking:

@Franky1 Oh yes, this step wasn’t very clear! You have to put the secrets.toml file into .gitignore, so it isn’t available on Github. Then you add the same file content to your app secrets on the Streamlit Sharing dashboard. That’s how the deployed app knows the secrets. I just updated the document to make this step a bit more obvious. Let me know if this is better!

2 Likes

Yes now it is better. :+1:

However, I am still missing the clear information that the file .streamlit/secrets.toml is needed for the local execution of Streamlit to be read by the function st.secrets and on streamlit sharing this file is replaced by the content entered in the secrets form.

This becomes indirectly clear in the course of the article, but I think the basic principle should be explained right at the beginning.