sqlglot.dialects.dremio
1from __future__ import annotations 2 3from sqlglot import tokens 4from sqlglot.dialects.dialect import Dialect 5from sqlglot.generators.dremio import DremioGenerator 6from sqlglot.parsers.dremio import DremioParser 7 8 9class Dremio(Dialect): 10 SUPPORTS_USER_DEFINED_TYPES = False 11 CONCAT_COALESCE = True 12 CONCAT_WS_COALESCE = True 13 TYPED_DIVISION = True 14 NULL_ORDERING = "nulls_are_last" 15 SUPPORTS_VALUES_DEFAULT = False 16 17 TIME_MAPPING = { 18 # year 19 "YYYY": "%Y", 20 "yyyy": "%Y", 21 "YY": "%y", 22 "yy": "%y", 23 # month / day 24 "MM": "%m", 25 "mm": "%m", 26 "MON": "%b", 27 "mon": "%b", 28 "MONTH": "%B", 29 "month": "%B", 30 "DDD": "%j", 31 "ddd": "%j", 32 "DD": "%d", 33 "dd": "%d", 34 "DY": "%a", 35 "dy": "%a", 36 "DAY": "%A", 37 "day": "%A", 38 # hours / minutes / seconds 39 "HH24": "%H", 40 "hh24": "%H", 41 "HH12": "%I", 42 "hh12": "%I", 43 "HH": "%I", 44 "hh": "%I", # 24- / 12-hour 45 "MI": "%M", 46 "mi": "%M", 47 "SS": "%S", 48 "ss": "%S", 49 "FFF": "%f", 50 "fff": "%f", 51 "AMPM": "%p", 52 "ampm": "%p", 53 # ISO week / century etc. 54 "WW": "%W", 55 "ww": "%W", 56 "D": "%w", 57 "d": "%w", 58 "CC": "%C", 59 "cc": "%C", 60 # timezone 61 "TZD": "%Z", 62 "tzd": "%Z", # abbreviation (UTC, PST, ...) 63 "TZO": "%z", 64 "tzo": "%z", # numeric offset (+0200) 65 } 66 67 class Tokenizer(tokens.Tokenizer): 68 COMMENTS = ["--", "//", ("/*", "*/")] 69 70 Parser = DremioParser 71 72 Generator = DremioGenerator
10class Dremio(Dialect): 11 SUPPORTS_USER_DEFINED_TYPES = False 12 CONCAT_COALESCE = True 13 CONCAT_WS_COALESCE = True 14 TYPED_DIVISION = True 15 NULL_ORDERING = "nulls_are_last" 16 SUPPORTS_VALUES_DEFAULT = False 17 18 TIME_MAPPING = { 19 # year 20 "YYYY": "%Y", 21 "yyyy": "%Y", 22 "YY": "%y", 23 "yy": "%y", 24 # month / day 25 "MM": "%m", 26 "mm": "%m", 27 "MON": "%b", 28 "mon": "%b", 29 "MONTH": "%B", 30 "month": "%B", 31 "DDD": "%j", 32 "ddd": "%j", 33 "DD": "%d", 34 "dd": "%d", 35 "DY": "%a", 36 "dy": "%a", 37 "DAY": "%A", 38 "day": "%A", 39 # hours / minutes / seconds 40 "HH24": "%H", 41 "hh24": "%H", 42 "HH12": "%I", 43 "hh12": "%I", 44 "HH": "%I", 45 "hh": "%I", # 24- / 12-hour 46 "MI": "%M", 47 "mi": "%M", 48 "SS": "%S", 49 "ss": "%S", 50 "FFF": "%f", 51 "fff": "%f", 52 "AMPM": "%p", 53 "ampm": "%p", 54 # ISO week / century etc. 55 "WW": "%W", 56 "ww": "%W", 57 "D": "%w", 58 "d": "%w", 59 "CC": "%C", 60 "cc": "%C", 61 # timezone 62 "TZD": "%Z", 63 "tzd": "%Z", # abbreviation (UTC, PST, ...) 64 "TZO": "%z", 65 "tzo": "%z", # numeric offset (+0200) 66 } 67 68 class Tokenizer(tokens.Tokenizer): 69 COMMENTS = ["--", "//", ("/*", "*/")] 70 71 Parser = DremioParser 72 73 Generator = DremioGenerator
A NULL arg in CONCAT yields NULL by default, but in some dialects it yields an empty string.
A NULL arg in CONCAT_WS yields NULL by default, but in some dialects it is skipped.
Whether the behavior of a / b depends on the types of a and b.
False means a / b is always float division.
True means a / b is integer division if both a and b are integers.
Default NULL ordering method to use if not explicitly set.
Possible values: "nulls_are_small", "nulls_are_large", "nulls_are_last"
Associates this dialect's time formats with their equivalent Python strftime formats.
Whether string literals support escape sequences (e.g. \n). Set by the metaclass based on the tokenizer's STRING_ESCAPES.
Whether byte string literals support escape sequences. Set by the metaclass based on the tokenizer's BYTE_STRING_ESCAPES.
Inherited Members
- sqlglot.tokens.Tokenizer
- Tokenizer
- SINGLE_TOKENS
- BIT_STRINGS
- BYTE_STRINGS
- HEX_STRINGS
- RAW_STRINGS
- HEREDOC_STRINGS
- UNICODE_STRINGS
- IDENTIFIERS
- QUOTES
- STRING_ESCAPES
- VAR_SINGLE_TOKENS
- ESCAPE_FOLLOW_CHARS
- IDENTIFIER_ESCAPES
- HEREDOC_TAG_IS_IDENTIFIER
- HEREDOC_STRING_ALTERNATIVE
- STRING_ESCAPES_ALLOWED_IN_RAW_STRINGS
- NESTED_COMMENTS
- HINT_START
- TOKENS_PRECEDING_HINT
- KEYWORDS
- COMMANDS
- COMMAND_PREFIX_TOKENS
- NUMERIC_LITERALS
- NUMBERS_CAN_HAVE_DECIMALS
- dialect
- tokenize
- sql
- size
- tokens