google-cloud-sql

PostGIS installed, but unable to select version or add geography columns

浪子不回头ぞ 提交于 2020-01-24 21:26:24
问题 I've got an existing Postgres 9.6 database on Google Cloud that has the PostGIS extension enabled, however whenever I try to create a table with a column with the geography type or select the PostGIS version I get an error. For creating the geography column the error is non-descriptive — just an arrow pointing to the word geography in the following statement create table place(coordinate geography(POINT,4326)); The version error looks as follows: select postgis_full_version(); ERROR: could

mysql client connection gcloud

情到浓时终转凉″ 提交于 2020-01-24 04:26:10
问题 I have installed gcloud client library but GCP keeps on giving me this error what could the issue ERROR: (gcloud.sql.connect) Mysql client not found. Please install a mysql client and make sure it is in PATH to be able to connect to the database instance 回答1: The problem is that either you have not installed the MySQL client locally, or gcloud can't find it. If you have not installed MySQL yet, follow the instructions to do so. If you have installed MySQL but you're still getting this error,

Getting notAuthorized error with cloud_sql_proxy locally

霸气de小男生 提交于 2020-01-22 14:05:45
问题 I'm trying to setup a connection locally for 2nd generation cloud sql instance. Call for the proxy is ./cloud_sql_proxy -dir=/cloudsql -instances=status-1268:us-central1:status-dev=tcp:3306 & mysql -u status_stg --host 127.0.0.1 I am a bit unclear on how to set up correctly the service accounts from the API section, so I tried with both of the defaults, App engine default service account and Compute engine default service account. I also created a new one service account. For each one of them

Getting notAuthorized error with cloud_sql_proxy locally

倖福魔咒の 提交于 2020-01-22 14:05:07
问题 I'm trying to setup a connection locally for 2nd generation cloud sql instance. Call for the proxy is ./cloud_sql_proxy -dir=/cloudsql -instances=status-1268:us-central1:status-dev=tcp:3306 & mysql -u status_stg --host 127.0.0.1 I am a bit unclear on how to set up correctly the service accounts from the API section, so I tried with both of the defaults, App engine default service account and Compute engine default service account. I also created a new one service account. For each one of them

Connect to a database over a unix socket using SQLAlchemy

浪子不回头ぞ 提交于 2020-01-21 12:57:21
问题 I'm trying to connect to my Cloud SQL DB using SQLAlchemy from my cloud function but I can't seem to work out the correct connection string. DATABASE_URL=postgres://$DB_USER:$_DB_PWD@/$DB_NAME?unix_socket=/cloudsql/$DB_INSTANCE Which gives me the error: pyscopg2.ProgrammingError: invalid dns: invalid connection option "unix_socket" What is the correct way to connect to a Postgresql 9.6 DB over a unix socket using pyscopg2 ? 回答1: The special keyword needed here is host : DATABASE_URL=postgres:

Accessing Google Cloud SQL instance from Google Compute Engine?

試著忘記壹切 提交于 2020-01-17 04:04:07
问题 After spending a few hours, this is the only real documentation I can find for accessing Cloud SQL from outside of GAE: https://developers.google.com/cloud-sql/docs/external The problem is, this is for a Java application (via JDBC). I need to access my Cloud SQL DB from within a PHP, Dart, or NodeJS application. I thought by giving my GCE instance rights to connect to Cloud SQL, this would be easy. But no arrangement of socket strings (using mysql drivers) seems to be effective. For argument

Trouble connecting to Google Cloud SQL server from deployed app

跟風遠走 提交于 2020-01-15 05:56:22
问题 I am using a Google Cloud SQL instance (second generation) and I can successfully connect to it locally after authorizing my own IP. I have Go code that successfully retrieves rows from tables and I have code that successfully adds rows to tables. However, when I deploy my app, the app is unable to connect to the server. Any time an SQL function is called, the server returns a 500 response. My app is authorized to connect to this sql instance: I am using the following Go connection code: func

Does Cloud SQL Postgres have any cron-like tool?

倾然丶 夕夏残阳落幕 提交于 2020-01-15 03:29:27
问题 I would like to use Cloud SQL with PostgreSQL with an internal cron-like tool. In the extensions list I can't find anything like that. Do you know any solution/alternative which wouldn't include having an extra Compute Engine instance from where we can make calls ? 回答1: You can't run cron internally in Cloud SQL as it is fully managed and you only get the access to the database itself. Workaround If you need to run this inserts and selects each minute then you can use Google's Task queues to

Connecting to GCP Cloud SQL from App Engine in separate project

一笑奈何 提交于 2020-01-14 13:57:09
问题 I am trying to connect to a GCP Postgres Cloud SQL instance from a GCP Google App Engine flexible environment in a separate GCP project. I am using Python. The instructions indicate that this requires adding the default App Engine service account as an IAM member in the Postgres Cloud SQL project. The docs go on to state: Once deployed, your application uses the Cloud SQL Proxy that is built in to the App Engine flexible environment to communicate with your Cloud SQL instance. However, I've

How to make Django migrations on Google Cloud Platform?

大兔子大兔子 提交于 2020-01-14 03:17:11
问题 I would like to host my app on Google App Engine and have a Google SQL instance for the database. The main part of the app is an API built with Django Rest Framework. I asked Google Cloud Support about the best practices of making migrations in production when I need to modify the database's schema. Since I am new to web development, perhaps any experts here have similar experience and can verify if the suggested process is something what I can really follow? For database migration best