dremio-cli 1.0.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (45) hide show
  1. dremio_cli/__init__.py +5 -0
  2. dremio_cli/__main__.py +6 -0
  3. dremio_cli/cli.py +191 -0
  4. dremio_cli/client/__init__.py +1 -0
  5. dremio_cli/client/auth.py +100 -0
  6. dremio_cli/client/base.py +190 -0
  7. dremio_cli/client/cloud.py +305 -0
  8. dremio_cli/client/factory.py +122 -0
  9. dremio_cli/client/software.py +561 -0
  10. dremio_cli/commands/__init__.py +1 -0
  11. dremio_cli/commands/catalog.py +143 -0
  12. dremio_cli/commands/favorite.py +162 -0
  13. dremio_cli/commands/folder.py +290 -0
  14. dremio_cli/commands/grant.py +202 -0
  15. dremio_cli/commands/history.py +122 -0
  16. dremio_cli/commands/job.py +321 -0
  17. dremio_cli/commands/lineage.py +9 -0
  18. dremio_cli/commands/profile.py +165 -0
  19. dremio_cli/commands/role.py +319 -0
  20. dremio_cli/commands/source.py +375 -0
  21. dremio_cli/commands/space.py +226 -0
  22. dremio_cli/commands/sql.py +280 -0
  23. dremio_cli/commands/table.py +155 -0
  24. dremio_cli/commands/tag.py +145 -0
  25. dremio_cli/commands/udf.py +9 -0
  26. dremio_cli/commands/user.py +250 -0
  27. dremio_cli/commands/view.py +369 -0
  28. dremio_cli/commands/wiki.py +163 -0
  29. dremio_cli/config.py +193 -0
  30. dremio_cli/env.py +175 -0
  31. dremio_cli/formatters/__init__.py +1 -0
  32. dremio_cli/formatters/json.py +19 -0
  33. dremio_cli/formatters/table.py +45 -0
  34. dremio_cli/formatters/yaml.py +17 -0
  35. dremio_cli/history.py +198 -0
  36. dremio_cli/utils/__init__.py +1 -0
  37. dremio_cli/utils/exceptions.py +35 -0
  38. dremio_cli/utils/helpers.py +73 -0
  39. dremio_cli/utils/validators.py +147 -0
  40. dremio_cli-1.0.0.dist-info/METADATA +261 -0
  41. dremio_cli-1.0.0.dist-info/RECORD +45 -0
  42. dremio_cli-1.0.0.dist-info/WHEEL +5 -0
  43. dremio_cli-1.0.0.dist-info/entry_points.txt +2 -0
  44. dremio_cli-1.0.0.dist-info/licenses/LICENSE +21 -0
  45. dremio_cli-1.0.0.dist-info/top_level.txt +1 -0
dremio_cli/config.py ADDED
@@ -0,0 +1,193 @@
1
+ """Profile and configuration management."""
2
+
3
+ import os
4
+ from pathlib import Path
5
+ from typing import Any, Dict, Optional
6
+
7
+ import yaml
8
+ from rich.console import Console
9
+
10
+ from dremio_cli.env import load_dotenv, merge_env_profiles
11
+
12
+ console = Console()
13
+
14
+
15
+ class ProfileManager:
16
+ """Manages Dremio CLI profiles."""
17
+
18
+ def __init__(self, config_dir: Optional[Path] = None):
19
+ """Initialize profile manager.
20
+
21
+ Args:
22
+ config_dir: Configuration directory path. Defaults to ~/.dremio
23
+ """
24
+ self.config_dir = config_dir or Path.home() / ".dremio"
25
+ self.config_file = self.config_dir / "profiles.yaml"
26
+ self._ensure_config_dir()
27
+
28
+ def _ensure_config_dir(self) -> None:
29
+ """Ensure configuration directory exists."""
30
+ self.config_dir.mkdir(parents=True, exist_ok=True)
31
+
32
+ def _load_config(self) -> Dict[str, Any]:
33
+ """Load configuration from file and merge with environment variables.
34
+
35
+ Environment variables take precedence over YAML configuration.
36
+ """
37
+ # Load .env file if it exists
38
+ load_dotenv()
39
+
40
+ # Load YAML config
41
+ if not self.config_file.exists():
42
+ yaml_config = {"default_profile": None, "profiles": {}}
43
+ else:
44
+ with open(self.config_file, "r") as f:
45
+ yaml_config = yaml.safe_load(f) or {"default_profile": None, "profiles": {}}
46
+
47
+ # Merge environment variable profiles
48
+ yaml_profiles = yaml_config.get("profiles", {})
49
+ merged_profiles = merge_env_profiles(yaml_profiles)
50
+
51
+ yaml_config["profiles"] = merged_profiles
52
+
53
+ # Set default profile from environment if specified
54
+ env_default = os.environ.get("DREMIO_PROFILE")
55
+ if env_default and env_default in merged_profiles:
56
+ yaml_config["default_profile"] = env_default
57
+
58
+ return yaml_config
59
+
60
+ def _save_config(self, config: Dict[str, Any]) -> None:
61
+ """Save configuration to file."""
62
+ with open(self.config_file, "w") as f:
63
+ yaml.dump(config, f, default_flow_style=False, sort_keys=False)
64
+
65
+ def list_profiles(self) -> Dict[str, Dict[str, Any]]:
66
+ """List all profiles."""
67
+ config = self._load_config()
68
+ return config.get("profiles", {})
69
+
70
+ def get_profile(self, name: str) -> Optional[Dict[str, Any]]:
71
+ """Get a specific profile by name."""
72
+ profiles = self.list_profiles()
73
+ return profiles.get(name)
74
+
75
+ def get_default_profile(self) -> Optional[str]:
76
+ """Get the default profile name."""
77
+ config = self._load_config()
78
+ return config.get("default_profile")
79
+
80
+ def create_profile(
81
+ self,
82
+ name: str,
83
+ profile_type: str,
84
+ base_url: str,
85
+ auth_type: str,
86
+ project_id: Optional[str] = None,
87
+ token: Optional[str] = None,
88
+ username: Optional[str] = None,
89
+ password: Optional[str] = None,
90
+ ) -> None:
91
+ """Create a new profile.
92
+
93
+ Args:
94
+ name: Profile name
95
+ profile_type: 'cloud' or 'software'
96
+ base_url: Base URL for Dremio API
97
+ auth_type: Authentication type ('pat', 'oauth', 'username_password')
98
+ project_id: Project ID (required for cloud)
99
+ token: Authentication token
100
+ username: Username (for username_password auth)
101
+ password: Password (for username_password auth)
102
+ """
103
+ config = self._load_config()
104
+
105
+ if name in config["profiles"]:
106
+ raise ValueError(f"Profile '{name}' already exists")
107
+
108
+ profile: Dict[str, Any] = {
109
+ "type": profile_type,
110
+ "base_url": base_url,
111
+ "auth": {"type": auth_type},
112
+ }
113
+
114
+ if project_id:
115
+ profile["project_id"] = project_id
116
+
117
+ if token:
118
+ profile["auth"]["token"] = token
119
+
120
+ if username:
121
+ profile["auth"]["username"] = username
122
+
123
+ if password:
124
+ profile["auth"]["password"] = password
125
+
126
+ config["profiles"][name] = profile
127
+
128
+ # Set as default if it's the first profile
129
+ if not config["default_profile"]:
130
+ config["default_profile"] = name
131
+
132
+ self._save_config(config)
133
+
134
+ def update_profile(self, name: str, updates: Dict[str, Any]) -> None:
135
+ """Update an existing profile.
136
+
137
+ Args:
138
+ name: Profile name
139
+ updates: Dictionary of updates to apply
140
+ """
141
+ config = self._load_config()
142
+
143
+ if name not in config["profiles"]:
144
+ raise ValueError(f"Profile '{name}' does not exist")
145
+
146
+ profile = config["profiles"][name]
147
+
148
+ # Update top-level fields
149
+ for key in ["type", "base_url", "project_id"]:
150
+ if key in updates:
151
+ profile[key] = updates[key]
152
+
153
+ # Update auth fields
154
+ if "auth" in updates:
155
+ if "auth" not in profile:
156
+ profile["auth"] = {}
157
+ profile["auth"].update(updates["auth"])
158
+
159
+ self._save_config(config)
160
+
161
+ def delete_profile(self, name: str) -> None:
162
+ """Delete a profile.
163
+
164
+ Args:
165
+ name: Profile name
166
+ """
167
+ config = self._load_config()
168
+
169
+ if name not in config["profiles"]:
170
+ raise ValueError(f"Profile '{name}' does not exist")
171
+
172
+ del config["profiles"][name]
173
+
174
+ # Update default if we deleted it
175
+ if config["default_profile"] == name:
176
+ remaining = list(config["profiles"].keys())
177
+ config["default_profile"] = remaining[0] if remaining else None
178
+
179
+ self._save_config(config)
180
+
181
+ def set_default_profile(self, name: str) -> None:
182
+ """Set the default profile.
183
+
184
+ Args:
185
+ name: Profile name
186
+ """
187
+ config = self._load_config()
188
+
189
+ if name not in config["profiles"]:
190
+ raise ValueError(f"Profile '{name}' does not exist")
191
+
192
+ config["default_profile"] = name
193
+ self._save_config(config)
dremio_cli/env.py ADDED
@@ -0,0 +1,175 @@
1
+ """Environment variable configuration loader.
2
+
3
+ Supports loading profiles from environment variables using the pattern:
4
+ DREMIO_{PROFILE}_{KEY}={VALUE}
5
+
6
+ Example:
7
+ DREMIO_CLOUD_TOKEN=xxx
8
+ DREMIO_CLOUD_PROJECTID=yyy
9
+ DREMIO_CLOUD_TYPE=cloud
10
+ DREMIO_SOFTWARE_TOKEN=zzz
11
+ DREMIO_SOFTWARE_BASE_URL=https://v26.dremio.org
12
+ DREMIO_SOFTWARE_TYPE=software
13
+ """
14
+
15
+ import os
16
+ from typing import Dict, Any, Optional, List
17
+ from pathlib import Path
18
+
19
+
20
+ def load_dotenv(dotenv_path: Optional[Path] = None) -> None:
21
+ """Load environment variables from .env file.
22
+
23
+ Args:
24
+ dotenv_path: Path to .env file. If None, looks in current directory.
25
+ """
26
+ if dotenv_path is None:
27
+ dotenv_path = Path.cwd() / ".env"
28
+
29
+ if not dotenv_path.exists():
30
+ return
31
+
32
+ with open(dotenv_path, "r") as f:
33
+ for line in f:
34
+ line = line.strip()
35
+ if not line or line.startswith("#"):
36
+ continue
37
+
38
+ if "=" in line:
39
+ key, value = line.split("=", 1)
40
+ os.environ[key.strip()] = value.strip()
41
+
42
+
43
+ def get_profile_names_from_env() -> List[str]:
44
+ """Get list of profile names defined in environment variables.
45
+
46
+ Returns:
47
+ List of profile names found in environment variables
48
+ """
49
+ profiles = set()
50
+ prefix = "DREMIO_"
51
+
52
+ for key in os.environ.keys():
53
+ if key.startswith(prefix):
54
+ parts = key.split("_")
55
+ if len(parts) >= 3: # DREMIO_PROFILENAME_KEY
56
+ profile_name = parts[1].lower()
57
+ profiles.add(profile_name)
58
+
59
+ return sorted(list(profiles))
60
+
61
+
62
+ def get_profile_from_env(profile_name: str) -> Optional[Dict[str, Any]]:
63
+ """Load a profile from environment variables.
64
+
65
+ Args:
66
+ profile_name: Name of the profile to load
67
+
68
+ Returns:
69
+ Profile dictionary or None if not found
70
+ """
71
+ profile_name_upper = profile_name.upper()
72
+ prefix = f"DREMIO_{profile_name_upper}_"
73
+
74
+ profile_data: Dict[str, Any] = {}
75
+ auth_data: Dict[str, Any] = {}
76
+
77
+ # Collect all environment variables for this profile
78
+ for key, value in os.environ.items():
79
+ if key.startswith(prefix):
80
+ # Extract the key name after the profile prefix
81
+ config_key = key[len(prefix):].lower()
82
+
83
+ # Map environment variable names to profile structure
84
+ if config_key == "type":
85
+ profile_data["type"] = value
86
+ elif config_key == "base_url":
87
+ profile_data["base_url"] = value
88
+ elif config_key == "projectid":
89
+ profile_data["project_id"] = value
90
+ elif config_key == "token":
91
+ auth_data["token"] = value
92
+ elif config_key == "username":
93
+ auth_data["username"] = value
94
+ elif config_key == "password":
95
+ auth_data["password"] = value
96
+ elif config_key == "auth_type":
97
+ auth_data["type"] = value
98
+ elif config_key == "testing_folder":
99
+ # Store testing folder for test utilities
100
+ profile_data["testing_folder"] = value
101
+ else:
102
+ # Store any other keys as-is
103
+ profile_data[config_key] = value
104
+
105
+ if not profile_data:
106
+ return None
107
+
108
+ # Set default base URLs if not specified
109
+ if "base_url" not in profile_data:
110
+ if profile_data.get("type") == "cloud":
111
+ profile_data["base_url"] = "https://api.dremio.cloud/v0"
112
+ elif profile_data.get("type") == "software":
113
+ # No default for software, must be specified
114
+ pass
115
+
116
+ # Determine auth type if not specified
117
+ if "type" not in auth_data:
118
+ if "token" in auth_data:
119
+ auth_data["type"] = "pat"
120
+ elif "username" in auth_data and "password" in auth_data:
121
+ auth_data["type"] = "username_password"
122
+
123
+ if auth_data:
124
+ profile_data["auth"] = auth_data
125
+
126
+ return profile_data
127
+
128
+
129
+ def get_env_override(key: str, default: Optional[str] = None) -> Optional[str]:
130
+ """Get environment variable override.
131
+
132
+ Supports both DREMIO_KEY and KEY formats.
133
+
134
+ Args:
135
+ key: Environment variable key (without DREMIO_ prefix)
136
+ default: Default value if not found
137
+
138
+ Returns:
139
+ Environment variable value or default
140
+ """
141
+ # Try with DREMIO_ prefix first
142
+ value = os.environ.get(f"DREMIO_{key.upper()}")
143
+ if value is not None:
144
+ return value
145
+
146
+ # Try without prefix
147
+ value = os.environ.get(key.upper())
148
+ if value is not None:
149
+ return value
150
+
151
+ return default
152
+
153
+
154
+ def merge_env_profiles(yaml_profiles: Dict[str, Dict[str, Any]]) -> Dict[str, Dict[str, Any]]:
155
+ """Merge environment variable profiles with YAML profiles.
156
+
157
+ Environment variables take precedence over YAML.
158
+
159
+ Args:
160
+ yaml_profiles: Profiles loaded from YAML file
161
+
162
+ Returns:
163
+ Merged profiles dictionary
164
+ """
165
+ merged = yaml_profiles.copy()
166
+
167
+ # Load all profiles from environment
168
+ env_profile_names = get_profile_names_from_env()
169
+
170
+ for profile_name in env_profile_names:
171
+ env_profile = get_profile_from_env(profile_name)
172
+ if env_profile:
173
+ merged[profile_name] = env_profile
174
+
175
+ return merged
@@ -0,0 +1 @@
1
+ """Output formatters for CLI."""
@@ -0,0 +1,19 @@
1
+ """JSON output formatter."""
2
+
3
+ import json
4
+ from typing import Any
5
+
6
+
7
+ def format_as_json(data: Any, pretty: bool = True) -> str:
8
+ """Format data as JSON.
9
+
10
+ Args:
11
+ data: Data to format
12
+ pretty: Whether to pretty-print
13
+
14
+ Returns:
15
+ JSON string
16
+ """
17
+ if pretty:
18
+ return json.dumps(data, indent=2, sort_keys=False)
19
+ return json.dumps(data)
@@ -0,0 +1,45 @@
1
+ """Table output formatter."""
2
+
3
+ from typing import Any, Dict, List
4
+
5
+ from rich.console import Console
6
+ from rich.table import Table
7
+
8
+
9
+ def format_as_table(data: Any, title: str = None) -> None:
10
+ """Format data as a table.
11
+
12
+ Args:
13
+ data: Data to format (dict, list of dicts, or simple value)
14
+ title: Optional table title
15
+ """
16
+ console = Console()
17
+
18
+ if isinstance(data, list) and data and isinstance(data[0], dict):
19
+ # List of dictionaries - create table
20
+ table = Table(title=title)
21
+
22
+ # Add columns from first item
23
+ for key in data[0].keys():
24
+ table.add_column(str(key).replace("_", " ").title(), style="cyan")
25
+
26
+ # Add rows
27
+ for item in data:
28
+ table.add_row(*[str(v) for v in item.values()])
29
+
30
+ console.print(table)
31
+
32
+ elif isinstance(data, dict):
33
+ # Single dictionary - create key-value table
34
+ table = Table(title=title, show_header=False)
35
+ table.add_column("Key", style="cyan")
36
+ table.add_column("Value", style="green")
37
+
38
+ for key, value in data.items():
39
+ table.add_row(str(key).replace("_", " ").title(), str(value))
40
+
41
+ console.print(table)
42
+
43
+ else:
44
+ # Simple value
45
+ console.print(data)
@@ -0,0 +1,17 @@
1
+ """YAML output formatter."""
2
+
3
+ from typing import Any
4
+
5
+ import yaml
6
+
7
+
8
+ def format_as_yaml(data: Any) -> str:
9
+ """Format data as YAML.
10
+
11
+ Args:
12
+ data: Data to format
13
+
14
+ Returns:
15
+ YAML string
16
+ """
17
+ return yaml.dump(data, default_flow_style=False, sort_keys=False)
dremio_cli/history.py ADDED
@@ -0,0 +1,198 @@
1
+ """Query history and favorites management."""
2
+
3
+ import sqlite3
4
+ import json
5
+ from datetime import datetime
6
+ from pathlib import Path
7
+ from typing import List, Dict, Any, Optional
8
+
9
+
10
+ class HistoryManager:
11
+ """Manage query history and favorites."""
12
+
13
+ def __init__(self, db_path: Optional[str] = None):
14
+ """Initialize history manager.
15
+
16
+ Args:
17
+ db_path: Path to SQLite database (default: ~/.dremio/history.db)
18
+ """
19
+ if db_path is None:
20
+ dremio_dir = Path.home() / ".dremio"
21
+ dremio_dir.mkdir(exist_ok=True)
22
+ db_path = str(dremio_dir / "history.db")
23
+
24
+ self.db_path = db_path
25
+ self._init_db()
26
+
27
+ def _init_db(self):
28
+ """Initialize database schema."""
29
+ conn = sqlite3.connect(self.db_path)
30
+ cursor = conn.cursor()
31
+
32
+ # History table
33
+ cursor.execute("""
34
+ CREATE TABLE IF NOT EXISTS history (
35
+ id INTEGER PRIMARY KEY AUTOINCREMENT,
36
+ command TEXT NOT NULL,
37
+ query TEXT,
38
+ profile TEXT,
39
+ timestamp TEXT NOT NULL,
40
+ success INTEGER DEFAULT 1
41
+ )
42
+ """)
43
+
44
+ # Favorites table
45
+ cursor.execute("""
46
+ CREATE TABLE IF NOT EXISTS favorites (
47
+ name TEXT PRIMARY KEY,
48
+ query TEXT NOT NULL,
49
+ description TEXT,
50
+ created_at TEXT NOT NULL,
51
+ updated_at TEXT NOT NULL
52
+ )
53
+ """)
54
+
55
+ conn.commit()
56
+ conn.close()
57
+
58
+ def add_history(self, command: str, query: Optional[str] = None,
59
+ profile: Optional[str] = None, success: bool = True):
60
+ """Add command to history.
61
+
62
+ Args:
63
+ command: Command executed
64
+ query: SQL query if applicable
65
+ profile: Profile name used
66
+ success: Whether command succeeded
67
+ """
68
+ conn = sqlite3.connect(self.db_path)
69
+ cursor = conn.cursor()
70
+
71
+ cursor.execute("""
72
+ INSERT INTO history (command, query, profile, timestamp, success)
73
+ VALUES (?, ?, ?, ?, ?)
74
+ """, (command, query, profile, datetime.now().isoformat(), 1 if success else 0))
75
+
76
+ conn.commit()
77
+ conn.close()
78
+
79
+ def get_history(self, limit: int = 50) -> List[Dict[str, Any]]:
80
+ """Get recent history.
81
+
82
+ Args:
83
+ limit: Maximum number of entries
84
+
85
+ Returns:
86
+ List of history entries
87
+ """
88
+ conn = sqlite3.connect(self.db_path)
89
+ conn.row_factory = sqlite3.Row
90
+ cursor = conn.cursor()
91
+
92
+ cursor.execute("""
93
+ SELECT * FROM history
94
+ ORDER BY id DESC
95
+ LIMIT ?
96
+ """, (limit,))
97
+
98
+ rows = cursor.fetchall()
99
+ conn.close()
100
+
101
+ return [dict(row) for row in rows]
102
+
103
+ def get_history_item(self, history_id: int) -> Optional[Dict[str, Any]]:
104
+ """Get specific history item.
105
+
106
+ Args:
107
+ history_id: History entry ID
108
+
109
+ Returns:
110
+ History entry or None
111
+ """
112
+ conn = sqlite3.connect(self.db_path)
113
+ conn.row_factory = sqlite3.Row
114
+ cursor = conn.cursor()
115
+
116
+ cursor.execute("SELECT * FROM history WHERE id = ?", (history_id,))
117
+ row = cursor.fetchone()
118
+ conn.close()
119
+
120
+ return dict(row) if row else None
121
+
122
+ def clear_history(self):
123
+ """Clear all history."""
124
+ conn = sqlite3.connect(self.db_path)
125
+ cursor = conn.cursor()
126
+ cursor.execute("DELETE FROM history")
127
+ conn.commit()
128
+ conn.close()
129
+
130
+ def add_favorite(self, name: str, query: str, description: Optional[str] = None):
131
+ """Add or update favorite.
132
+
133
+ Args:
134
+ name: Favorite name
135
+ query: SQL query
136
+ description: Optional description
137
+ """
138
+ conn = sqlite3.connect(self.db_path)
139
+ cursor = conn.cursor()
140
+
141
+ now = datetime.now().isoformat()
142
+
143
+ cursor.execute("""
144
+ INSERT OR REPLACE INTO favorites (name, query, description, created_at, updated_at)
145
+ VALUES (?, ?, ?,
146
+ COALESCE((SELECT created_at FROM favorites WHERE name = ?), ?),
147
+ ?)
148
+ """, (name, query, description, name, now, now))
149
+
150
+ conn.commit()
151
+ conn.close()
152
+
153
+ def get_favorites(self) -> List[Dict[str, Any]]:
154
+ """Get all favorites.
155
+
156
+ Returns:
157
+ List of favorites
158
+ """
159
+ conn = sqlite3.connect(self.db_path)
160
+ conn.row_factory = sqlite3.Row
161
+ cursor = conn.cursor()
162
+
163
+ cursor.execute("SELECT * FROM favorites ORDER BY name")
164
+ rows = cursor.fetchall()
165
+ conn.close()
166
+
167
+ return [dict(row) for row in rows]
168
+
169
+ def get_favorite(self, name: str) -> Optional[Dict[str, Any]]:
170
+ """Get specific favorite.
171
+
172
+ Args:
173
+ name: Favorite name
174
+
175
+ Returns:
176
+ Favorite or None
177
+ """
178
+ conn = sqlite3.connect(self.db_path)
179
+ conn.row_factory = sqlite3.Row
180
+ cursor = conn.cursor()
181
+
182
+ cursor.execute("SELECT * FROM favorites WHERE name = ?", (name,))
183
+ row = cursor.fetchone()
184
+ conn.close()
185
+
186
+ return dict(row) if row else None
187
+
188
+ def delete_favorite(self, name: str):
189
+ """Delete favorite.
190
+
191
+ Args:
192
+ name: Favorite name
193
+ """
194
+ conn = sqlite3.connect(self.db_path)
195
+ cursor = conn.cursor()
196
+ cursor.execute("DELETE FROM favorites WHERE name = ?", (name,))
197
+ conn.commit()
198
+ conn.close()
@@ -0,0 +1 @@
1
+ """Utility functions and helpers."""
@@ -0,0 +1,35 @@
1
+ """Custom exceptions for Dremio CLI."""
2
+
3
+
4
+ class DremioCliError(Exception):
5
+ """Base exception for Dremio CLI errors."""
6
+ pass
7
+
8
+
9
+ class ProfileNotFoundError(DremioCliError):
10
+ """Raised when a profile is not found."""
11
+ pass
12
+
13
+
14
+ class AuthenticationError(DremioCliError):
15
+ """Raised when authentication fails."""
16
+ pass
17
+
18
+
19
+ class ApiError(DremioCliError):
20
+ """Raised when an API request fails."""
21
+
22
+ def __init__(self, message: str, status_code: int = None, response_body: str = None):
23
+ super().__init__(message)
24
+ self.status_code = status_code
25
+ self.response_body = response_body
26
+
27
+
28
+ class ValidationError(DremioCliError):
29
+ """Raised when input validation fails."""
30
+ pass
31
+
32
+
33
+ class ConfigurationError(DremioCliError):
34
+ """Raised when configuration is invalid."""
35
+ pass