Skip to content

Update google clouddb#602

Merged
wtgee merged 8 commits intopanoptes:developfrom
wtgee:update-google-clouddb
Sep 18, 2018
Merged

Update google clouddb#602
wtgee merged 8 commits intopanoptes:developfrom
wtgee:update-google-clouddb

Conversation

@wtgee
Copy link
Copy Markdown
Member

@wtgee wtgee commented Sep 17, 2018

Part of #599, depends on #600.

Adds the cloud_sql_proxy from google for connecting to cloud sql instances. Also includes a simple wrapper script that will pull the setup information from the config.

Adds a few utility functions:

  • get_db_proxy_conn
  • get_cursor
  • meta_insert
  • add_header_to_db

Note As of now this still requires the user to set a PGPASSWORD to authenticate against the actual database table. We might want to look at ways to mitigate that.

@wtgee wtgee requested a review from jamessynge September 17, 2018 01:02
@wtgee wtgee mentioned this pull request Sep 17, 2018
13 tasks
Comment thread conf_files/pocs.yaml Outdated
msg_port: 6510

############ Google Network ############
# By default all images are stored on google
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm sure we could fit this text on two lines instead of four! ;-)

Comment thread scripts/connect_clouddb_proxy.py Outdated
####################################
# connect_clouddb_proxy.py
#
# This is a simple wrapper that looks up
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I recall advocating for 80 column lines, but this is really short! ;-)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Soon I'm going to push for 2-character lines! ;)

Comment thread scripts/connect_clouddb_proxy.py Outdated

def main(instance_id, local_port, verbose=False):
proxy_cmd = os.path.join(os.environ['POCS'], 'bin', 'cloud_sql_proxy')
connection_str = '-instances={}=tcp:{}'.format(instance_id, local_port)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

connection_str seems like the wrong name for this var. Not sure if the following makes sense:

connection_str = '{}=tcp:{}'.format(instance_id, local_port)
instances_arg = '-instances={}'.format(connection_str)

@wtgee wtgee merged commit ace091e into panoptes:develop Sep 18, 2018
@wtgee wtgee deleted the update-google-clouddb branch September 18, 2018 03:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants