Using SSHTunnel and Connecting to MySQL DB #162
Unanswered
KowshikBokka
asked this question in
Q&A
Replies: 2 comments 1 reply
-
Hi @KowshikBokka , I'm not sure why
cx.read_sql("mysql://db_user:[email protected]:local_port/db", query) Maybe it can be a quick workaround. Thanks for the report. |
Beta Was this translation helpful? Give feedback.
0 replies
-
Hello @wangxiaoying Thanks for the response. It does work in the terminal however, I do want to schedule the python script on cloud function so I am still stuck on this as I can't do manual workaround every time. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I tried different configuration but end up with timed out waiting for connection everytime.
Please let me know that best way to achieve this
This is my code
with SSHTunnelForwarder( (ssh_host, ssh_port), ssh_username=ssh_user, ssh_pkey=mypkey, remote_bind_address=(sql_hostname, sql_port)) as tunnel: start_time = time.time() df = cx.read_sql(url,mysql_query) print("--- %s seconds ---" % (time.time() - start_time))
Beta Was this translation helpful? Give feedback.
All reactions