News for hackers. Stuff that matters.
Re:Show HN: SPyQL – SQL with Python in the middle by BeefWellington on Wednesday January 26, 2022 @11:42PM (#30096296)
Interesting concept.

It's always intriguing to me that no major database vendors have added support for Python, Javascript, Lua, et. al, for their expression and stored procedure definition languages. It would really make things more accessible than Transact-SQL[1], Oracle's P/SQL[2] or DB2's messy external procedure support.[3]

[1]: https://docs.microsoft.com/en-us/sql/t-sql/statements/create...

[2]: https://docs.oracle.com/cd/B19306_01/server.102/b14200/state...

[3]: https://www.ibm.com/docs/en/db2/11.5?topic=statements-create...

Re:Show HN: SPyQL – SQL with Python in the middle by adeelk93 on Thursday January 27, 2022 @12:07AM (#30096456)
BigQuery supports JavaScript UDFs [1]. But I bet Python isn’t popular in a database for performance reasons.

[1]: https://cloud.google.com/bigquery/docs/reference/standard-sq...

Re:Show HN: SPyQL – SQL with Python in the middle by shrikant on Thursday January 27, 2022 @08:48AM (#30100489)
Redshift lets you create UDFs in Python (2.7), and via Lambda functions (for any language runtime supported by AWS Lambda).

https://docs.aws.amazon.com/redshift/latest/dg/user-defined-...

Re:Show HN: SPyQL – SQL with Python in the middle by jaguar1878 on Thursday January 27, 2022 @12:44AM (#30096648)
You may find this interesting: https://docs.oracle.com/en/graalvm/enterprise/21/docs/exampl...

Examples show Javascript execution.

Re:Show HN: SPyQL – SQL with Python in the middle by BeefWellington on Thursday January 27, 2022 @01:41AM (#30097017)
I stand corrected! Thanks for passing that along. It's been awhile since I worked with Oracle (last was an 11g instance).
Re:Show HN: SPyQL – SQL with Python in the middle by mixmastamyk on Thursday January 27, 2022 @02:05AM (#30097178)
Postgres has supported Python for quite a while.
Re:Show HN: SPyQL – SQL with Python in the middle by dmoura on Thursday January 27, 2022 @06:15AM (#30099048)
yep, unfortunately due to security concerns is not supported everywhere (DB as a service): `ERROR: Extension "plpythonu" is not supported by Amazon RDS`
Re:Show HN: SPyQL – SQL with Python in the middle by BeefWellington on Thursday January 27, 2022 @08:49AM (#30100498)
Unfortunately the Postgres implementation is marked unsafe for a reason. There's not a sufficient sandbox in place to prevent shenanigans.
Re:Show HN: SPyQL – SQL with Python in the middle by mixmastamyk on Saturday January 29, 2022 @01:11PM (#30128746)
If you’re writing the code and sanitizing inputs you only have yourself to blame. Just like every other app ever written?
Re:Show HN: SPyQL – SQL with Python in the middle by tacone on Thursday January 27, 2022 @04:43AM (#30098303)
Postgres also supports Javascript
Re:Show HN: SPyQL – SQL with Python in the middle by ako on Thursday January 27, 2022 @02:54AM (#30097550)
Oracle has had java support in the RDBMS for more than 20 years, probably more than 25 years...
Re:Show HN: SPyQL – SQL with Python in the middle by hoppla on Thursday January 27, 2022 @02:33AM (#30097410)
MongoDB supports JavaScript
Re:Show HN: SPyQL – SQL with Python in the middle by tasogare on Thursday January 27, 2022 @05:46AM (#30098796)
C# and few other .net languages can be used in SQL Server for more than a decade: https://en.m.wikipedia.org/wiki/SQL_CLR
Re:Show HN: SPyQL – SQL with Python in the middle by BeefWellington on Thursday January 27, 2022 @08:54AM (#30100555)
Yes, but similar to Python on Postgresql, it comes with a bunch of security warnings attached.

I should have clarified in my original post but I'm envisioning more of: database server has a parser that understands python/javascript/c#/etc but projects a subset of library functions to avoid security dangers.

Essentially, expose the same functionality stored procedures already have but in a more accessible syntax.

What vendors mostly seem to have opted for is embedding the full language parsers directly into the database servers, which yields a lot of power and a lot of risk.