I’ve looked in vain for an answer to my issue. I have a db web app that runs fine locally and I have deployed for users to access. It has predefined SQL queries that can be executed with results from BigQuery. It uses pandas_gbq library to process the queries. I have the secrets file saved accordingly and the contents in my app’s secret section. I get the following error message when I try and execute a query:
BigQuery API is enabled. In the Credentials tab I have an API key with HTTP referrers and an OAuth 2.0 Client ID. BigQuery API and BigQuery Data Transfer API are the API restricted. I’ve added https://oauth2.googleapis.com/token in the Authorized redirect URI field and https://share.streamlit.io in the Authorized Javascript origins field.
I don’t know what I am missing. Any help would be appreciated!
That’s a strange one @Mark_Moralls. When you copied your secrets into the interface, did you make sure to convert it to toml instead of the JSON that Google usually provides?
We played around internally a bit, we think this might be a case of not setting a project_id. Because Streamlit Cloud is hosted on Google Cloud, it looks like the Python library infers a project you don’t have access to.
So check that value in the Secrets interface and let us know if that resolves it.
Thanks for looking into my issue. Yes, it was a strange one and I did verify the secrets file to TOML format. I thought the credentials line was enough to make the connection to the project id.
So after going back to the pandas_gbq documentation, I did set a project id variable and added project_id and credentials to each of my df variable entries:
Thanks for stopping by! We use cookies to help us understand how you interact with our website.
By clicking “Accept all”, you consent to our use of cookies. For more information, please see our privacy policy.
Cookie settings
Strictly necessary cookies
These cookies are necessary for the website to function and cannot be switched off. They are usually only set in response to actions made by you which amount to a request for services, such as setting your privacy preferences, logging in or filling in forms.
Performance cookies
These cookies allow us to count visits and traffic sources so we can measure and improve the performance of our site. They help us understand how visitors move around the site and which pages are most frequently visited.
Functional cookies
These cookies are used to record your choices and settings, maintain your preferences over time and recognize you when you return to our website. These cookies help us to personalize our content for you and remember your preferences.
Targeting cookies
These cookies may be deployed to our site by our advertising partners to build a profile of your interest and provide you with content that is relevant to you, including showing you relevant ads on other websites.