Let’s Get Certified
Module 05 / 21 · Data foundations

Data sources

Choose how to collect files, database records, API responses, and event logs. Work through JDBC and HTTP examples.

Data stores, databases, warehouses and marts

Four terms describe the systems data is kept in and read from. They overlap, so learn what each one implies.

TermWhat it meansTraits to remember
Data storeAny repository that persistently stores and manages data. Broad term; usually implies unstructured or semi-structured data.A database is a subset. Can be flat files, email, distributed storage, directory services.
DatabaseA data store for structured or semi-structured data that needs formal design and modelingRelational (row or column oriented) or non-relational. "Database" usually means a relational row store such as MySQL, SQL Server, PostgreSQL, MariaDB.
Data warehouseStore designed for analytics, generally column oriented, for terabytes and millions of rowsOptimized for aggregations; "hot" (fast answers) but queried for periodic reports rather than real time; fed by ETL from operational databases; essentially read-only (load, then read; not transactional).
Data martA subset of a warehouse focused on one business area or teamSmaller (a common rule of thumb is under 100 GB), read-only, cheaper and faster to query, so accessed more often.

In a lakehouse, a "data mart" is usually a gold schema per domain (for example main.gold_finance) with its own Unity Catalog grants, rather than a separate system.

Sources and their typical ingestion

BI and ETL tools connect to many sources and extract data in one of three ways: on demand when a report runs, on a schedule, or as a continuous stream. The mechanism differs by source.

SourceExamplesTypical Databricks ingestion
Files in cloud object storageCSV, JSON, Parquet drops in S3, ADLS Gen2, GCSAuto Loader, COPY INTO, read_files
Local filesA CSV on your laptopUI "Create or modify table" upload, or upload to a volume
Operational databasesSQL Server, PostgreSQL, MySQL, OracleLakeflow Connect managed database connectors (CDC), JDBC reads, Lakehouse Federation (query in place)
SaaS applicationsSalesforce, Workday, ServiceNow, Google AnalyticsLakeflow Connect managed connectors, partner tools such as Fivetran
Message buses / event streamsApache Kafka, Amazon Kinesis, Azure Event Hubs, Google Pub/SubStructured Streaming source, streaming tables
REST APIsVendor HTTP APIsPython requests in a notebook, landing JSON to a volume or table, scheduled by Lakeflow Jobs
Other Databricks / partnersData shared by another companyDelta Sharing, Marketplace

Push vs pull

  • Pull: Databricks reads from the source on a schedule (JDBC query, API call, listing files).
  • Push: the source sends data (to Kafka, to a storage bucket). Databricks reacts with a stream or a file arrival trigger.

Reading a database with JDBC

df = (spark.read.format("jdbc")
      .option("url", "jdbc:postgresql://host:5432/shop")
      .option("dbtable", "public.orders")
      .option("user", dbutils.secrets.get("shop-scope", "pg-user"))
      .option("password", dbutils.secrets.get("shop-scope", "pg-pass"))
      .load())
df.write.mode("append").saveAsTable("main.bronze.orders")
Exam focus

Never hardcode credentials. Use secrets: dbutils.secrets.get(scope, key). Secret values are redacted (shown as [REDACTED]) in notebook output. Secret scopes are created with the Databricks CLI or API.

Reading from a REST API

import requests, json
resp = requests.get("https://api.example.com/v1/rates", timeout=30)
resp.raise_for_status()
dbutils.fs.put("/Volumes/main/raw/landing/rates_2026-11-17.json", resp.text, overwrite=True)

Land the raw response to a volume, then let Auto Loader pick it up into bronze. That keeps ingestion replayable.

Audit logs as a data source

Databricks itself produces data, such as audit logs and system tables. Audit logs delivered to your storage bucket are JSON files, typically delivered within 15 minutes of the event, and a later delivery can overwrite an existing file. Pipelines reading them must tolerate overwrites. Today most teams query the system.access.audit system table instead.

Choose a source contract

A web API enforces a per-minute rate limit and supplies a cursor for its next page. When should the pipeline advance its stored cursor?

Check your reasoning

Advance only after durably landing the page or committing its records. A retry can then re-read the previous page. Keep a stable record key or page identifier so replay is safe.

Product reference

Ingest data with SQL and Spark APIs in the Databricks documentation

Knowledge check

Data sources quiz

Answer 4 questions. Check each answer for an explanation.