Alternative to user defined functions in Google's Cloud SQL
Asked Answered
I

1

9

I just transferred my database to Google's Cloud SQL, but as stated in the FAQ on Google Cloud SQL, it says user defined functions are not supported. I am using a function called Levenshtein, taken from this stackoverflow article, to perform a search on a dictionary that I created in my database. It is a function that can find words that look similar (including misspellings) and returns the distance from a given word.

Does Google offer any alternatives to user defined functions that would allow me to use this functionality to perform search?

Inwrap answered 18/4, 2015 at 9:15 Comment(4)
No it doesn't. However you could use gce and in there use any database you want.Psychedelic
Yes, CloudSQL is essentially sandboxed MySQL so simply running MySQL (or another DB) on a Compute Engine instance might be your best solution.Fighter
is a lame that Google does not support this, one of the reason i could consider a Cloud based infrastructure would be the ability to migrate my db to CloudSQL to take advantage of power, performance and scalability so I base my app on UDF and stored procedures.Jiles
Apparently if you use GCE (Google Cloud Engine) you can completely control your database. But you cannot do this using GAE (Google App Engine). See #22697549 for more about the difference.Inwrap
P
12

You are confused about terminology:

  • User Defined Function = A function defined in real code, compiled into a DLL/SO, and created in MySQL with CREATE FUNCTION ... SONAME. This is not possible in Cloud SQL.

  • Stored Procedure = A function defined in SQL statements, and created in MySQL with CREATE FUNCTION routine_body or CREATE PROCEDURE. This is allowed in Cloud SQL.

I just tested this out by copying and pasting the definition from that SO post into my Cloud SQL instance and it worked perfectly.

Ptarmigan answered 22/9, 2015 at 22:14 Comment(1)
Agreed. I meant Stored Procedure. I tested the code from the SO article and it gave some SQL errors, but it did create the function however. Thanks for the help!Inwrap

© 2022 - 2024 — McMap. All rights reserved.