Category Archive

Other Computer Stuff

Notes on connecting a Cloud Function to Cloud SQL


Posted on July 24, 2023 by alanysiu

Caveat I’m not a Google Cloud Platform expert, and this isn’t a tutorial. I’m just hoping that if people run into the same errors I ran into and search for those exact error messages, that they’ll find this blog post, and maybe it’ll be helpful to them. What I found Making the connection Google’s documentation on connecting a Cloud Function to Cloud SQL isn’t super straightforward. When I tried to implement their examples, I came across all sorts of errors like: sqlalchemy.exc.InterfaceError: (pg8000.exceptions.InterfaceError) communication error (Background on this error at: https://sqlalche.me/e/20/rvf5) or File "/workspace/main.py", line 58, in postgres_connect sqlalchemy.engine.url.URL.create(AttributeError: type

0

How to use Google Apps Script to get data from a connected data sheet


Posted on May 13, 2023 by alanysiu

Regular sheets are straightforward For a regular Google Sheets spreadsheet, it’s fairly easy to use Google Apps Script to get the data contained on a worksheet:     var spreadsheet = SpreadsheetApp.getActive();     var regularsheet = spreadsheet.getSheets()[0];     var range = regularsheet.getDataRange();     var values = range.getValues();     for ( j = 0; j < values.length; j++ ){         Logger.log(values[j][0] + ': ' + values[j][1]);     } The nice thing about the getDataRange() function is that it just automatically grabs all the cells have data in them. You don’t have to specify to start at this column or end at this particular row. Connected sheets You can connect

0

“looks like a filename, but the file does not exist” error when deploying a Cloud Function


Posted on July 18, 2022 by alanysiu

Caveat This fits in the category of “What it ended up being for me, and it may help someone else” and not “I’m an expert on all gcloud errors, and this is always the solution,” so please resist the urge to comment with “This didn’t solve it for me. What’s the solution to my problem?” The answer will probably be “I don’t know what the solution to your problem is, then.” Problem I was trying to deploy a Google Cloud Function using gcloud functions deploy, and I kept getting this error: WARNING: Requirement './SUBDIR/NAMEOFCUSTOMPYTHONMODULE.whl' looks like a filename, but the

0

Changing ownership of files in Google Drive via Google Apps Script


Posted on March 20, 2020 by alanysiu

This was a fun little exercise in Google Apps Script to essentially transfer ownership of Google Drive files from one user to another. Here’s a script that the old user should run to change ownership of those files to the new user: ChangeFileFolderOwnership.js And here’s a script that the new user user should run to remove the old user as editor from the newly changed-ownership files: RemoveEditorFromDriveFiles.js Note: You cannot use the file.removeEditor() command to remove yourself as an editor, so that actually has to be run from the new owner’s account. Another Note: Just as when you change ownership

12