Databricks Connector and Utilities¶
DatabricksDBFSConnector ¶
Bases: Connector
Connector for Databricks DBFS paths and Unity/Hive tables.
Supports reading and writing Delta (default), Parquet, and CSV for DBFS paths.
read ¶
read(spark: SparkSession, source: Any, *, fmt: Optional[str] = None, schema: Optional[Any] = None, source_config: Optional[Mapping[str, Any]] = None, options: Optional[Mapping[str, Any]] = None, **kwargs: Any) -> DataFrame
Read a dataset from Databricks storage or catalogs.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
spark
|
SparkSession
|
Active |
required |
source
|
Any
|
Either a |
required |
fmt
|
Optional[str]
|
Optional format override for DBFS reads ( |
None
|
schema
|
Optional[Any]
|
Optional schema to enforce for file reads. Not supported for table reads. |
None
|
source_config
|
Optional[Mapping[str, Any]]
|
Connector-specific settings (e.g., |
None
|
options
|
Optional[Mapping[str, Any]]
|
Additional Spark read options. |
None
|
Source code in src/spark_fuse/io/databricks.py
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 |
|
validate_path ¶
validate_path(path: str) -> bool
Return True if the input looks like a DBFS path or Databricks table identifier.
Source code in src/spark_fuse/io/databricks.py
25 26 27 28 29 30 31 32 |
|
write ¶
write(df: DataFrame, path: str, *, fmt: Optional[str] = None, mode: str = 'error', **options: Any) -> None
Write a dataset to DBFS.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
df
|
DataFrame
|
DataFrame to write. |
required |
path
|
str
|
Output DBFS location. |
required |
fmt
|
Optional[str]
|
Optional format override: |
None
|
mode
|
str
|
Save mode, e.g. |
'error'
|
**options
|
Any
|
Additional Spark write options. |
{}
|
Source code in src/spark_fuse/io/databricks.py
175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 |
|
databricks_submit_job ¶
databricks_submit_job(payload: Dict[str, Any], *, host: Optional[str] = None, token: Optional[str] = None) -> Dict[str, Any]
Submit a job run to Databricks using the 2.1 Runs Submit API.
Environment variables DATABRICKS_HOST
and DATABRICKS_TOKEN
are used if not provided.
Returns the parsed JSON response or raises for HTTP errors.
Source code in src/spark_fuse/io/databricks.py
270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 |
|