Django backend for Snowflake
Project description
Snowflake backend for Django
Install and usage
Use the version of django-snowflake that corresponds to your version of Django. For example, to get the latest compatible release for Django 3.2.x:
pip install django-snowflake==3.2.*
The minor release number of Django doesn't correspond to the minor release number of django-snowflake. Use the latest minor release of each.
Configure the Django DATABASES setting similar to this:
DATABASES = {
'default': {
'ENGINE': 'django_snowflake',
'NAME': 'MY_DATABASE',
'SCHEMA': 'MY_SCHEME',
'WAREHOUSE': 'MY_WAREHOUSE',
'USER': 'my_user',
'PASSWORD': 'my_password',
'ACCOUNT': 'my_account',
},
}
Notes on Django fields
-
Snowflake supports defining foreign key and unique constraints, however, it doesn't enforce them. Thus, Django manages these constraints and
inspectdbdetects them, but Django won't raiseIntegrityErrorif they're violated. -
Snowflake doesn't support indexes. Thus, Django ignores any indexes defined on models or fields.
-
JSONFieldis not supported. -
Snowflake doesn't support check constraints, so the various
PositiveIntegerFieldmodel fields allow negative values (though validation at the form level still works).
Notes on Django QuerySets
-
Snowflake has limited support for subqueries.
-
In Snowflake, the
regexlookup pattern is implicitly anchored at both ends (i.e.''automatically becomes'^$'), which gives different results than other databases. -
Valid values for
QuerySet.explain()'sformatparameter are'json','tabular', and'text'. The default is'tabular'. -
Snowflake requires field names to be quoted in
RawSQLunless the column names are uppercase.
Known issues and limitations
This list isn't exhaustive. If you run into a problem, consult
django_snowflake/features.py to see if a similar test is skipped. Please
create an issue on GitHub
if you encounter an issue worth documenting.
-
Snowflake doesn't support
last_insert_idto retrieve the ID of a newly created object. Instead, this backend issues the querySELECT MAX(pk_name) FROM table_nameto retrieve the ID. This is subject to race conditions if objects are created concurrently. This makes this backend inappropriate for use in web app use cases where multiple clients could be creating objects at the same time. Further, you should not manually specify an ID (e.g.MyModel(id=1)) when creating an object. -
Snowflake only supports single layer transactions, but Django's
TestCaserequires that the database supports nested transactions. Therefore, Django'sTestCaseoperates likeTransactionTestCase, without the benefit of transactions to speed it up. A future version of Django (4.1 at the earliest) may leverage Snowflake's single layer transactions to give some speed up. -
Interval math where the interval is a column is not supported.
-
Interval math with a null interval crashes.
-
Violating a
NOT NULLconstraint raisesProgrammingErrorrather thanIntegrityError.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file django-snowflake-3.2a1.tar.gz.
File metadata
- Download URL: django-snowflake-3.2a1.tar.gz
- Upload date:
- Size: 19.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.7.0 importlib_metadata/4.8.2 pkginfo/1.8.2 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
cd22961c3960fcb8e4d78cb238b01d2ba4c0a3aac2ba83ba71ad7b4b86e2749d
|
|
| MD5 |
5f1ba070b9f6e5309d62380f21d51668
|
|
| BLAKE2b-256 |
43186da1ff361aeddc8b82b5a873698014402638be6e635efeaa05fb552084e7
|
File details
Details for the file django_snowflake-3.2a1-py3-none-any.whl.
File metadata
- Download URL: django_snowflake-3.2a1-py3-none-any.whl
- Upload date:
- Size: 20.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.7.0 importlib_metadata/4.8.2 pkginfo/1.8.2 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7a7348bc1612f6077587c52445c44c0ad6a6564b6339f01e2d07cd3d0d6a39f7
|
|
| MD5 |
b06c9a4c914cdc952b5561106752bb52
|
|
| BLAKE2b-256 |
30b6e6321e7cd2d262a61c497602cebfd01f54c4df2cac2ec9e8d00f59f23e52
|