Google Cloud SQL
This is the implementation of the Google Cloud SQL data handler for MindsDB.
Cloud SQL is a fully-managed database service that makes it easy to set up, maintain, manage, and administer your relational PostgreSQL, MySQL, and SQL Server databases in the cloud.
Prerequisites
Before proceeding, ensure the following prerequisites are met:
- Install MindsDB locally via Docker or Docker Desktop.
- To connect Google Cloud SQL to MindsDB, install the required dependencies following this instruction.
- Install or ensure access to Google Cloud SQL.
Implementation
This handler was implemented using the existing MindsDB handlers for MySQL, PostgreSQL and SQL Server.
The required arguments to establish a connection are,
host
: the host name or IP address of the Google Cloud SQL instance.port
: the TCP/IP port of the Google Cloud SQL instance.user
: the username used to authenticate with the Google Cloud SQL instance.password
: the password to authenticate the user with the Google Cloud SQL instance.database
: the database name to use when connecting with the Google Cloud SQL instance.db_engine
: the database engine of the Google Cloud SQL instance. This can take one of three values: ‘mysql’, ‘postgresql’ or ‘mssql’.
Usage
In order to make use of this handler and connect to the Google Cloud SQL instance, you need to create a datasource with the following syntax:
To successfully connect to the Google Cloud SQL instance you have to make sure that the IP address of the machine you are using to connect is added to the authorized networks of the Google Cloud SQL instance. You can do this by following the steps below:
- Go to the Cloud SQL Instances page.
- Click on the instance you want to add authorized networks to.
- Click on the Connections tab.
- Click on Networking tab.
- Click on Add network.
- Enter the IP address of the machine you want to connect from.
If you are using MindsDB cloud version you can use the following IP address: 18.220.205.95 3.19.152.46 52.14.91.162
You can use this established connection to query your table as follows:
Was this page helpful?