forked from databricks/databricks-sql-python
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconstants.py
More file actions
68 lines (48 loc) · 1.67 KB
/
constants.py
File metadata and controls
68 lines (48 loc) · 1.67 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
"""
Constants for the Statement Execution API (SEA) backend.
"""
from typing import Dict
from enum import Enum
# from https://docs.databricks.com/aws/en/sql/language-manual/sql-ref-parameters
ALLOWED_SESSION_CONF_TO_DEFAULT_VALUES_MAP: Dict[str, str] = {
"ANSI_MODE": "true",
"ENABLE_PHOTON": "true",
"LEGACY_TIME_PARSER_POLICY": "Exception",
"MAX_FILE_PARTITION_BYTES": "128m",
"READ_ONLY_EXTERNAL_METASTORE": "false",
"STATEMENT_TIMEOUT": "0",
"TIMEZONE": "UTC",
"USE_CACHED_RESULT": "true",
"QUERY_TAGS": "",
}
class ResultFormat(Enum):
"""Enum for result format values."""
ARROW_STREAM = "ARROW_STREAM"
JSON_ARRAY = "JSON_ARRAY"
class ResultDisposition(Enum):
"""Enum for result disposition values."""
HYBRID = "INLINE_OR_EXTERNAL_LINKS"
EXTERNAL_LINKS = "EXTERNAL_LINKS"
INLINE = "INLINE"
class ResultCompression(Enum):
"""Enum for result compression values."""
LZ4_FRAME = "LZ4_FRAME"
NONE = None
class WaitTimeout(Enum):
"""Enum for wait timeout values."""
ASYNC = "0s"
SYNC = "10s"
class MetadataCommands(Enum):
"""SQL commands used in the SEA backend.
These constants are used for metadata operations and other SQL queries
to ensure consistency and avoid string literal duplication.
"""
SHOW_CATALOGS = "SHOW CATALOGS"
SHOW_SCHEMAS = "SHOW SCHEMAS IN {}"
SHOW_TABLES = "SHOW TABLES IN {}"
SHOW_TABLES_ALL_CATALOGS = "SHOW TABLES IN ALL CATALOGS"
SHOW_COLUMNS = "SHOW COLUMNS IN CATALOG {}"
LIKE_PATTERN = " LIKE '{}'"
SCHEMA_LIKE_PATTERN = " SCHEMA" + LIKE_PATTERN
TABLE_LIKE_PATTERN = " TABLE" + LIKE_PATTERN
CATALOG_SPECIFIC = "CATALOG {}"