Development of an internal social media platform with personalised dashboards for students
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

features.py 2.0KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. from django.db import utils
  2. from django.db.backends.base.features import BaseDatabaseFeatures
  3. from django.utils.functional import cached_property
  4. class DatabaseFeatures(BaseDatabaseFeatures):
  5. # SQLite cannot handle us only partially reading from a cursor's result set
  6. # and then writing the same rows to the database in another cursor. This
  7. # setting ensures we always read result sets fully into memory all in one
  8. # go.
  9. can_use_chunked_reads = False
  10. test_db_allows_multiple_connections = False
  11. supports_unspecified_pk = True
  12. supports_timezones = False
  13. max_query_params = 999
  14. supports_mixed_date_datetime_comparisons = False
  15. supports_column_check_constraints = False
  16. autocommits_when_autocommit_is_off = True
  17. can_introspect_decimal_field = False
  18. can_introspect_positive_integer_field = True
  19. can_introspect_small_integer_field = True
  20. supports_transactions = True
  21. atomic_transactions = False
  22. can_rollback_ddl = True
  23. supports_atomic_references_rename = False
  24. supports_paramstyle_pyformat = False
  25. supports_sequence_reset = False
  26. can_clone_databases = True
  27. supports_temporal_subtraction = True
  28. ignores_table_name_case = True
  29. supports_cast_with_precision = False
  30. uses_savepoints = True
  31. can_release_savepoints = True
  32. @cached_property
  33. def supports_stddev(self):
  34. """
  35. Confirm support for STDDEV and related stats functions.
  36. SQLite supports STDDEV as an extension package; so
  37. connection.ops.check_expression_support() can't unilaterally
  38. rule out support for STDDEV. Manually check whether the call works.
  39. """
  40. with self.connection.cursor() as cursor:
  41. cursor.execute('CREATE TABLE STDDEV_TEST (X INT)')
  42. try:
  43. cursor.execute('SELECT STDDEV(*) FROM STDDEV_TEST')
  44. has_support = True
  45. except utils.DatabaseError:
  46. has_support = False
  47. cursor.execute('DROP TABLE STDDEV_TEST')
  48. return has_support