Looking for relevant python code to be used in the GCP AI Platform notebook which will be able to query GCP Cloud SQL (specifically Postgresql.) Unfortunately, I haven't found any relevat resources/tutorials from GCP official or even unaffiliated resources.
Access GCP Cloud SQL from AI notebook?
1.2k Views Asked by jbuddy_13 At
1
There are 1 best solutions below
Related Questions in PYTHON
- adding constraint under pyomo environment
- Spyder does not find glpsol
- In Pyomo, Is it possible to write an objective function or a constraint based on several Expressions?
- Build Pyomo Sets into a Python dictionnary
- How do you install glpk-solver along with pyomo in Winpython
- Pyomo solves over NVIDIA Cuda
- Multi indexed constraints or objectives in Pyomo
- Pyomo Variable with Bounds=(0.0, None) getting a Minus Value
- Returning results of a Pyomo optimisation from a function
- Pyomo + asNMPC framework
Related Questions in POSTGRESQL
- adding constraint under pyomo environment
- Spyder does not find glpsol
- In Pyomo, Is it possible to write an objective function or a constraint based on several Expressions?
- Build Pyomo Sets into a Python dictionnary
- How do you install glpk-solver along with pyomo in Winpython
- Pyomo solves over NVIDIA Cuda
- Multi indexed constraints or objectives in Pyomo
- Pyomo Variable with Bounds=(0.0, None) getting a Minus Value
- Returning results of a Pyomo optimisation from a function
- Pyomo + asNMPC framework
Related Questions in GOOGLE-CLOUD-PLATFORM
- adding constraint under pyomo environment
- Spyder does not find glpsol
- In Pyomo, Is it possible to write an objective function or a constraint based on several Expressions?
- Build Pyomo Sets into a Python dictionnary
- How do you install glpk-solver along with pyomo in Winpython
- Pyomo solves over NVIDIA Cuda
- Multi indexed constraints or objectives in Pyomo
- Pyomo Variable with Bounds=(0.0, None) getting a Minus Value
- Returning results of a Pyomo optimisation from a function
- Pyomo + asNMPC framework
Related Questions in GCP-AI-PLATFORM-NOTEBOOK
- adding constraint under pyomo environment
- Spyder does not find glpsol
- In Pyomo, Is it possible to write an objective function or a constraint based on several Expressions?
- Build Pyomo Sets into a Python dictionnary
- How do you install glpk-solver along with pyomo in Winpython
- Pyomo solves over NVIDIA Cuda
- Multi indexed constraints or objectives in Pyomo
- Pyomo Variable with Bounds=(0.0, None) getting a Minus Value
- Returning results of a Pyomo optimisation from a function
- Pyomo + asNMPC framework
Trending Questions
- UIImageView Frame Doesn't Reflect Constraints
- Is it possible to use adb commands to click on a view by finding its ID?
- How to create a new web character symbol recognizable by html/javascript?
- Why isn't my CSS3 animation smooth in Google Chrome (but very smooth on other browsers)?
- Heap Gives Page Fault
- Connect ffmpeg to Visual Studio 2008
- Both Object- and ValueAnimator jumps when Duration is set above API LvL 24
- How to avoid default initialization of objects in std::vector?
- second argument of the command line arguments in a format other than char** argv or char* argv[]
- How to improve efficiency of algorithm which generates next lexicographic permutation?
- Navigating to the another actvity app getting crash in android
- How to read the particular message format in android and store in sqlite database?
- Resetting inventory status after order is cancelled
- Efficiently compute powers of X in SSE/AVX
- Insert into an external database using ajax and php : POST 500 (Internal Server Error)
Popular # Hahtags
Popular Questions
- How do I undo the most recent local commits in Git?
- How can I remove a specific item from an array in JavaScript?
- How do I delete a Git branch locally and remotely?
- Find all files containing a specific text (string) on Linux?
- How do I revert a Git repository to a previous commit?
- How do I create an HTML button that acts like a link?
- How do I check out a remote Git branch?
- How do I force "git pull" to overwrite local files?
- How do I list all files of a directory?
- How to check whether a string contains a substring in JavaScript?
- How do I redirect to another webpage?
- How can I iterate over rows in a Pandas DataFrame?
- How do I convert a String to an int in Java?
- Does Python have a string 'contains' substring method?
- How do I check if a string contains a specific word?
I work on the Developer Relations team for Cloud SQL at Google. The quickest and simplest way to connect to a Cloud SQL instance from an AI Platform Notebook is to use our newly released Cloud SQL Python Connector. To install, run
pip install cloud-sql-python-connector[pg8000]
. This will also install the pg8000 driver which is used to connect to Postgres.Then, you can use the following code to get a connection object which you can use to run queries:
An alternative, which is language-independent, is to download and run the Cloud SQL Auth Proxy in a separate terminal from your notebook.
For either of these solutions, make sure to enable the Cloud SQL Admin API first.