Error when trying to use Google Cloud SQL

45 views
Skip to first unread message

Jonathan Tomm

unread,
Apr 25, 2017, 10:33:01 AM4/25/17
to web2py-users
I'm struggling to get a basic test app deployed to Google App Engine using Cloud SQL.

1. I cloned web2py of github two days ago.

2. I created a Google Cloud SQL instance.

3. I created a new sample app called "SQL" using the web2py admin interface.

4. On the new app, I changed the following line in db.py

db = DAL('google:datastore+ndb')

to

db = DAL('google:sql://web2py-test-165504:my-sql-instance/mysql')

5. I deployed web2py to GAE:

gcloud app deploy --project web2py-test-165504

After deployment, I can view the Welcome app no problem, since it is using Datastore. But when I go to my app called "SQL", I get an error.

Here is the traceback:

ERROR    2017-04-24 22:51:17,829 restricted.py:171] Traceback (most recent call last):
  File "C:\Users\Jonathan\Documents\Python\GoogleAppEngine\web2py\gluon\restricted.py", line 216, in restricted
    exec(ccode, environment)
  File "C:\Users\Jonathan\Documents\Python\GoogleAppEngine\web2py\applications\SQL\models\db.py", line 39, in <module>
    db1 = DAL('google:sql://root:web2py-test-165504/mydatabase')
  File "C:\Users\Jonathan\Documents\Python\GoogleAppEngine\web2py\gluon\packages\dal\pydal\base.py", line 170, in __call__
    obj = super(MetaDAL, cls).__call__(*args, **kwargs)
  File "C:\Users\Jonathan\Documents\Python\GoogleAppEngine\web2py\gluon\packages\dal\pydal\base.py", line 475, in __init__
    "Failure to connect, tried %d times:\n%s" % (attempts, tb)
RuntimeError: Failure to connect, tried 5 times:
Traceback (most recent call last):
  File "C:\Users\Jonathan\Documents\Python\GoogleAppEngine\web2py\gluon\packages\dal\pydal\base.py", line 455, in __init__
    self._adapter = adapter(**kwargs)
  File "C:\Users\Jonathan\Documents\Python\GoogleAppEngine\web2py\gluon\packages\dal\pydal\adapters\__init__.py", line 40, in __call__
    obj = super(AdapterMeta, cls).__call__(*args, **kwargs)
  File "C:\Users\Jonathan\Documents\Python\GoogleAppEngine\web2py\gluon\packages\dal\pydal\adapters\google.py", line 40, in __init__
    super(GoogleSQL, self).__init__(*args, **kwargs)
  File "C:\Users\Jonathan\Documents\Python\GoogleAppEngine\web2py\gluon\packages\dal\pydal\adapters\base.py", line 367, in __init__
    super(SQLAdapter, self).__init__(*args, **kwargs)
  File "C:\Users\Jonathan\Documents\Python\GoogleAppEngine\web2py\gluon\packages\dal\pydal\adapters\base.py", line 50, in __init__
    self._initialize_(do_connect)
  File "C:\Users\Jonathan\Documents\Python\GoogleAppEngine\web2py\gluon\packages\dal\pydal\adapters\google.py", line 49, in _initialize_
    super(MySQL, self)._initialize_(do_connect)
  File "C:\Users\Jonathan\Documents\Python\GoogleAppEngine\web2py\gluon\packages\dal\pydal\adapters\base.py", line 63, in _initialize_
    self._find_work_folder()
  File "C:\Users\Jonathan\Documents\Python\GoogleAppEngine\web2py\gluon\packages\dal\pydal\adapters\google.py", line 44, in _find_work_folder
    super(GoogleSQL)._find_work_folder()
AttributeError: 'super' object has no attribute '_find_work_folder'


I've also tried connecting to a local MySQL server following Massimo's directions here: https://groups.google.com/forum/#!topic/web2py/SJJBp1dq7VU

When I do, I get exactly the same error.

Any help would be appreciated!

webm...@trytha.com

unread,
May 2, 2017, 11:59:00 PM5/2/17
to web2py-users
Are you using OSX?  I have the same error and am trying to track down the problem.  Right now I think it might be something specific to macs.

Robert Porter

unread,
May 3, 2017, 4:18:47 PM5/3/17
to web...@googlegroups.com
Ah, I see your errors show "C:", so that's the output from the local Google Cloud instance on Windows?  Can you show the error message from the Google Cloud server logs (after you've deployed the app)?  When I tried to recreate the error in the cloud, it worked fine (unfortunately).

If it's a problem on Mac and Windows, maybe the developers are only testing GAE locally on Linux...
Reply all
Reply to author
Forward
0 new messages