We have written a Snowflake DB backend that we use internally in several projects and are considering releasing it for public use. My preference would be to incorporate it as a core backend so the nuances of Snowflake SQL are considered when changes are made to the core system. Is this something we should pursue?
Thanks,
Scott
On 22 Jan 2021, at 21:49, Scott Fought <foug...@apps.disney.com> wrote:
We have written a Snowflake DB backend that we use internally in several projects and are considering releasing it for public use. My preference would be to incorporate it as a core backend so the nuances of Snowflake SQL are considered when changes are made to the core system. Is this something we should pursue?
Thanks,
Scott
--
You received this message because you are subscribed to the Google Groups "Django developers (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-develop...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-developers/3e5034a8-6c75-4f28-9830-2c87b671ae86n%40googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-developers/08448193-19F7-4AA8-A112-ED6802DC7FBF%40tomforb.es.
On 22 Jan 2021, at 22:34, Scott Fought <foug...@apps.disney.com> wrote:
Snowflake (at this point) isn't as fast as PostgreSQL for smaller transactions. PostgreSQL couldn't handle the performance we needed to drive our apps and we really didn't want to support a hybrid db app. We give up a little speed for the convenience of having everything in one system. At a recent Snowflake event, they stated that 30% of their users were using Snowflake for application backends. They are also working to improve their execution time on smaller transactions.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-developers/cb99116e-65a8-458c-87a1-74458194d741n%40googlegroups.com.
> Honestly, I don't think we'd release this as a third party package. We have had to code around a lot of core db specific code to get Snow SQL to workThis is good feedback that is valuable for us to hear. Even if you don’t release it as a fully maintained package just understanding the pain points you encountered while developing this is great feedback that can help us improve.Would you be willing to share specific code snippets here, or just general areas that you found challenging while developing this backend?
Snowflake does not support lastrowid. So, we grab the last ID inserted with a 'SELECT MAX(pk_name) FROM table_name'. This is obviously prone to failure. Assigning an ID during the INSERT would provide similar results on all backends.
The feature flag `supports_transactions` really means `supports_nested_transactions`. Snowflake supports a single level of transaction, BEGIN + (ROLLBACK|COMMIT). Multiple BEGINS contribute to the current (only) transaction. Since I have to set this flag to False, no transactions are used, even ones that are supported and testing grinds to a crawl with all of the table truncations and repopulation. Since Django normally operates in auto-commit mode, this isn't a huge deal. Snowflake also doesn't support save points, but the feature flag seems to do what is expected when disabled.
Snowflake does not support column references without a FROM or JOIN clause. I've only encountered this used in the unit tests.
I've been able to work around most of the function differences by adding as_snowflake methods to the appropriate classes. There are a few cases like JSON_OBJECT that don't translate well, which work, but not entirely as expected.
A search for 'connection.vendor == ' in the core code shows one example of where core backends are given privileged access to core Django inner workings that 3rd party backends don't.
Please take these comments as observations, not complaints. I understand project evolution and the resistance to change something that doesn't seem broken. Maybe keep some of these thoughts in mind when a change is made to the core backends or the compiler and consider how other backends will need to implement that new feature.