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.
 
 
 
 

38 lines
1.0 KiB

  1. """
  2. Constants specific to the SQL storage portion of the ORM.
  3. """
  4. import re
  5. # Valid query types (a set is used for speedy lookups). These are (currently)
  6. # considered SQL-specific; other storage systems may choose to use different
  7. # lookup types.
  8. QUERY_TERMS = {
  9. 'exact', 'iexact', 'contains', 'icontains', 'gt', 'gte', 'lt', 'lte', 'in',
  10. 'startswith', 'istartswith', 'endswith', 'iendswith', 'range', 'year',
  11. 'month', 'day', 'week_day', 'hour', 'minute', 'second', 'isnull', 'search',
  12. 'regex', 'iregex',
  13. }
  14. # Size of each "chunk" for get_iterator calls.
  15. # Larger values are slightly faster at the expense of more storage space.
  16. GET_ITERATOR_CHUNK_SIZE = 100
  17. # Namedtuples for sql.* internal use.
  18. # How many results to expect from a cursor.execute call
  19. MULTI = 'multi'
  20. SINGLE = 'single'
  21. CURSOR = 'cursor'
  22. NO_RESULTS = 'no results'
  23. ORDER_PATTERN = re.compile(r'\?|[-+]?[.\w]+$')
  24. ORDER_DIR = {
  25. 'ASC': ('ASC', 'DESC'),
  26. 'DESC': ('DESC', 'ASC'),
  27. }
  28. # SQL join types.
  29. INNER = 'INNER JOIN'
  30. LOUTER = 'LEFT OUTER JOIN'