-
Notifications
You must be signed in to change notification settings - Fork 141
Expand file tree
/
Copy pathbase.py
More file actions
87 lines (63 loc) · 1.94 KB
/
base.py
File metadata and controls
87 lines (63 loc) · 1.94 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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
"""
Base models for the SEA (Statement Execution API) backend.
These models define the common structures used in SEA API requests and responses.
"""
from typing import Dict, List, Any, Optional, Union
from dataclasses import dataclass, field
from databricks.sql.backend.types import CommandState
@dataclass
class ServiceError:
"""Error information returned by the SEA API."""
message: str
error_code: Optional[str] = None
@dataclass
class StatementStatus:
"""Status information for a statement execution."""
state: CommandState
error: Optional[ServiceError] = None
sql_state: Optional[str] = None
@dataclass
class ExternalLink:
"""External link information for result data."""
external_link: str
expiration: str
chunk_index: int
byte_count: int = 0
row_count: int = 0
row_offset: int = 0
next_chunk_index: Optional[int] = None
next_chunk_internal_link: Optional[str] = None
http_headers: Optional[Dict[str, str]] = None
@dataclass
class ChunkInfo:
"""Information about a chunk in the result set."""
chunk_index: int
byte_count: int
row_offset: int
row_count: int
@dataclass
class ResultData:
"""Result data from a statement execution."""
data: Optional[List[List[Any]]] = None
external_links: Optional[List[ExternalLink]] = None
@dataclass
class ColumnInfo:
"""Information about a column in the result set."""
name: str
type_name: str
type_text: str
nullable: bool = True
precision: Optional[int] = None
scale: Optional[int] = None
ordinal_position: Optional[int] = None
@dataclass
class ResultManifest:
"""Manifest information for a result set."""
format: str
schema: Dict[str, Any] # Will contain column information
total_row_count: int
total_byte_count: int
total_chunk_count: int
truncated: bool = False
chunks: Optional[List[ChunkInfo]] = None
result_compression: Optional[str] = None