TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Ask HN: Python UDFs in SQL. Who is using?

6 pointsby scratchbufferover 2 years ago
Who is using Python UDFs in SQL?<p>Lately I&#x27;ve seen many of the data-warehouses&#x2F;lakes providers rolling out features that let&#x27;s you run Python UDFs as part of your SQL command. And, runs it close to the data.

2 comments

judellover 2 years ago
I&#x27;m a fan, and documented my journey in a series of posts including:<p><a href="https:&#x2F;&#x2F;blog.jonudell.net&#x2F;2021&#x2F;07&#x2F;24&#x2F;pl-pgsql-versus-pl-python-heres-why-im-using-both-to-write-postgres-functions&#x2F;" rel="nofollow">https:&#x2F;&#x2F;blog.jonudell.net&#x2F;2021&#x2F;07&#x2F;24&#x2F;pl-pgsql-versus-pl-pyth...</a><p><a href="https:&#x2F;&#x2F;blog.jonudell.net&#x2F;2021&#x2F;08&#x2F;13&#x2F;pl-python-metaprogramming&#x2F;" rel="nofollow">https:&#x2F;&#x2F;blog.jonudell.net&#x2F;2021&#x2F;08&#x2F;13&#x2F;pl-python-metaprogrammi...</a><p><a href="https:&#x2F;&#x2F;blog.jonudell.net&#x2F;2021&#x2F;08&#x2F;21&#x2F;postgres-functional-style&#x2F;" rel="nofollow">https:&#x2F;&#x2F;blog.jonudell.net&#x2F;2021&#x2F;08&#x2F;21&#x2F;postgres-functional-sty...</a>
timfiover 2 years ago
It may be &quot;close[r] to the data&quot;, but be ware Python UDFs usually still have context switches between the python interpreter and the query executor. If these pile up — as is the case if you fire off queries in, say, a loop — you will still see lousy performance. There is currently research under way, to optimize UDFs and other forms of computations over database resident data. For Python, for example, you can checkout the python to SQL compiler [0] and associated demo-paper [1] we produced for this years Sigmod. (Disclaimer: as you may have noticed thanks to that &quot; we&quot;, I&#x27;m an author on that paper.) Though it may only support a limited subset of Python, one can already do alot with just that.<p>[0]: <a href="https:&#x2F;&#x2F;apfel-db.informatik.uni-tuebingen.de" rel="nofollow">https:&#x2F;&#x2F;apfel-db.informatik.uni-tuebingen.de</a> [1]: <a href="https:&#x2F;&#x2F;db.inf.uni-tuebingen.de&#x2F;publications&#x2F;2022&#x2F;Hirn-grust-fischer" rel="nofollow">https:&#x2F;&#x2F;db.inf.uni-tuebingen.de&#x2F;publications&#x2F;2022&#x2F;Hirn-grust...</a>