PageRenderTime 46ms CodeModel.GetById 21ms RepoModel.GetById 1ms app.codeStats 0ms

/django/db/models/sql/constants.py

https://github.com/sesostris/django
Python | 33 lines | 19 code | 6 blank | 8 comment | 0 complexity | eb12b4723ff3b13a8fddd74577717f18 MD5 | raw file
Possible License(s): BSD-3-Clause
  1. from collections import namedtuple
  2. import re
  3. # Valid query types (a set is used for speedy lookups).
  4. QUERY_TERMS = set([
  5. 'exact', 'iexact', 'contains', 'icontains', 'gt', 'gte', 'lt', 'lte', 'in',
  6. 'startswith', 'istartswith', 'endswith', 'iendswith', 'range', 'year',
  7. 'month', 'day', 'week_day', 'isnull', 'search', 'regex', 'iregex',
  8. ])
  9. # Size of each "chunk" for get_iterator calls.
  10. # Larger values are slightly faster at the expense of more storage space.
  11. GET_ITERATOR_CHUNK_SIZE = 100
  12. # Separator used to split filter strings apart.
  13. LOOKUP_SEP = '__'
  14. # Constants to make looking up tuple values clearer.
  15. # Join lists (indexes into the tuples that are values in the alias_map
  16. # dictionary in the Query class).
  17. JoinInfo = namedtuple('JoinInfo',
  18. 'table_name rhs_alias join_type lhs_alias '
  19. 'lhs_join_col rhs_join_col nullable')
  20. # How many results to expect from a cursor.execute call
  21. MULTI = 'multi'
  22. SINGLE = 'single'
  23. ORDER_PATTERN = re.compile(r'\?|[-+]?[.\w]+$')
  24. ORDER_DIR = {
  25. 'ASC': ('ASC', 'DESC'),
  26. 'DESC': ('DESC', 'ASC'),
  27. }