---
title: Ingest with SQL and Spark APIs
description: Learn how to ingest data into Databricks Lakeflow Connect using SQL and Spark APIs for more customizable ingestion pipelines than managed connectors.
canonical_url: https://docs.databricks.com/aws/en/ingestion/
---

# Ingest with SQL and Spark APIs

This page describes how to ingest data into Databricks Lakeflow Connect using SQL and Spark APIs, which offer higher levels of ingestion pipeline customization compared to the managed connectors. Use it to choose an ingestion approach by data source and level of pipeline customization.

## <a id="etl-stack" /> Layers of the ETL stack

Some connectors operate at one level of the ETL stack. For example, Databricks offers fully-managed connectors for enterprise applications like Salesforce and databases like SQL Server. Other connectors operate at multiple layers of the ETL stack. For example, you can use SQL and Spark APIs in either Structured Streaming for full customization or Lakeflow pipelines for a more managed experience.

![ETL stack diagram](https://docs.databricks.com/aws/en/images/lakeflow-connect/etl-stack.png)

Databricks recommends starting with the most managed layer. If it doesn't satisfy your requirements (for example, if it doesn't support your data source), drop down to the next layer.

The following table describes the three layers of ingestion products, ordered from most customizable to most managed:

| Layer                                                                                        | Description                                                                                                                                                                                                                                                                                                                                                                                                  |
| -------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| [Structured Streaming](https://docs.databricks.com/aws/en/structured-streaming/concepts.md)  | Apache Spark Structured Streaming is a streaming engine that offers end-to-end fault tolerance with exactly-once processing guarantees using Spark APIs.                                                                                                                                                                                                                                                     |
| [Lakeflow pipelines](https://docs.databricks.com/aws/en/ldp/concepts/index.md)               | Lakeflow pipelines extend Structured Streaming, offering a declarative framework for creating data pipelines. You can define the transformations to perform on your data, and Lakeflow pipelines manage orchestration, monitoring, data quality, errors, and more. They offer more automation and less overhead than Structured Streaming.                                                                   |
| [Managed connectors](https://docs.databricks.com/aws/en/ingestion/lakeflow-connect/index.md) | Fully-managed connectors build on Lakeflow pipelines, offering even more automation for the most popular data sources. They extend Lakeflow pipelines functionality to also include source-specific authentication, CDC, edge case handling, long-term API maintenance, automated retries, automated schema evolution, and so on. Therefore, they offer even more automation for any supported data sources. |

## Choose an option

The following table lists SQL and Spark ingestion options by data source and level of pipeline customization. For a fully automated ingestion experience, use [managed connectors](https://docs.databricks.com/aws/en/ingestion/lakeflow-connect/index.md) instead.

SQL examples for incremental ingestion from cloud object storage use `CREATE STREAMING TABLE` syntax. It offers SQL users a scalable ingestion experience, therefore it's the recommended alternative to `COPY INTO`.

| Source               | More customization                                                                                                                                                                                                                                                                                                                 | Some customization                                                                                                                                                                                                                                                                                                                        | More automation                                                                                                                                                                                                                   |
| -------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Cloud object storage | [Auto Loader with Structured Streaming](https://docs.databricks.com/aws/en/ingestion/cloud-object-storage/auto-loader/unity-catalog.md)<br />![check mark yes](https://docs.databricks.com/aws/en/images/icons/check-icon.png) Python<br />![check mark yes](https://docs.databricks.com/aws/en/images/icons/check-icon.png) Scala | [Auto Loader with Lakeflow pipelines](https://docs.databricks.com/aws/en/ingestion/cloud-object-storage/auto-loader/patterns.md#pipeline-syntax)<br />![check mark yes](https://docs.databricks.com/aws/en/images/icons/check-icon.png) Python<br />![check mark yes](https://docs.databricks.com/aws/en/images/icons/check-icon.png) SQL | [Auto Loader with Databricks SQL](https://docs.databricks.com/aws/en/sql/mv-st/streaming.md#load-files-with-auto-loader)<br />![check mark yes](https://docs.databricks.com/aws/en/images/icons/check-icon.png) SQL               |
| SFTP servers         | [Ingest files from SFTP servers](https://docs.databricks.com/aws/en/ingestion/sftp.md)<br />(Python, SQL)                                                                                                                                                                                                                          | N/A                                                                                                                                                                                                                                                                                                                                       | N/A                                                                                                                                                                                                                               |
| Apache Kafka         | [Structured Streaming with Kafka source](https://docs.databricks.com/aws/en/connect/streaming/kafka/index.md)<br />![check mark yes](https://docs.databricks.com/aws/en/images/icons/check-icon.png) Python<br />![check mark yes](https://docs.databricks.com/aws/en/images/icons/check-icon.png) Scala                           | [Lakeflow pipelines with Kafka source](https://docs.databricks.com/aws/en/ldp/load.md#load-data-from-a-message-bus)<br />![check mark yes](https://docs.databricks.com/aws/en/images/icons/check-icon.png) Python<br />![check mark yes](https://docs.databricks.com/aws/en/images/icons/check-icon.png) SQL                              | [Databricks SQL with Kafka source](https://docs.databricks.com/aws/en/sql/mv-st/streaming.md#streaming-ingestion-from-other-sources)<br />![check mark yes](https://docs.databricks.com/aws/en/images/icons/check-icon.png) SQL   |
| Amazon Kinesis       | [Structured Streaming with Kinesis source](https://docs.databricks.com/aws/en/connect/streaming/kinesis/index.md)<br />![check mark yes](https://docs.databricks.com/aws/en/images/icons/check-icon.png) Python<br />![check mark yes](https://docs.databricks.com/aws/en/images/icons/check-icon.png) Scala                       | [Lakeflow pipelines with Kinesis source](https://docs.databricks.com/aws/en/ldp/load.md#load-data-from-a-message-bus)<br />![check mark yes](https://docs.databricks.com/aws/en/images/icons/check-icon.png) Python<br />![check mark yes](https://docs.databricks.com/aws/en/images/icons/check-icon.png) SQL                            | [Databricks SQL with Kinesis source](https://docs.databricks.com/aws/en/sql/mv-st/streaming.md#streaming-ingestion-from-other-sources)<br />![check mark yes](https://docs.databricks.com/aws/en/images/icons/check-icon.png) SQL |
| Google Pub/Sub       | [Structured Streaming with Pub/Sub source](https://docs.databricks.com/aws/en/connect/streaming/pub-sub.md)<br />![check mark yes](https://docs.databricks.com/aws/en/images/icons/check-icon.png) Python<br />![check mark yes](https://docs.databricks.com/aws/en/images/icons/check-icon.png) Scala                             | [Lakeflow pipelines with Pub/Sub source](https://docs.databricks.com/aws/en/ldp/load.md#load-data-from-a-message-bus)<br />![check mark yes](https://docs.databricks.com/aws/en/images/icons/check-icon.png) Python<br />![check mark yes](https://docs.databricks.com/aws/en/images/icons/check-icon.png) SQL                            | [Databricks SQL with Pub/Sub source](https://docs.databricks.com/aws/en/sql/mv-st/streaming.md#streaming-ingestion-from-other-sources)<br />![check mark yes](https://docs.databricks.com/aws/en/images/icons/check-icon.png) SQL |
| Apache Pulsar        | [Structured Streaming with Pulsar source](https://docs.databricks.com/aws/en/connect/streaming/pulsar.md)<br />![check mark yes](https://docs.databricks.com/aws/en/images/icons/check-icon.png) Python<br />![check mark yes](https://docs.databricks.com/aws/en/images/icons/check-icon.png) Scala                               | [Lakeflow pipelines with Pulsar source](https://docs.databricks.com/aws/en/ldp/load.md#load-data-from-a-message-bus)<br />![check mark yes](https://docs.databricks.com/aws/en/images/icons/check-icon.png) Python<br />![check mark yes](https://docs.databricks.com/aws/en/images/icons/check-icon.png) SQL                             | [Databricks SQL with Pulsar source](https://docs.databricks.com/aws/en/sql/mv-st/streaming.md#streaming-ingestion-from-other-sources)<br />![check mark yes](https://docs.databricks.com/aws/en/images/icons/check-icon.png) SQL  |

## <a id="schedules" />Ingestion schedules

You can configure ingestion pipelines to run on a recurring schedule or continuously.

| Use case            | Pipeline mode                                                                                                                                         |
| ------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------- |
| Batch ingestion     | [Triggered](https://docs.databricks.com/aws/en/ldp/concepts/pipeline-mode.md#triggered): Processes new data on a schedule or when manually triggered. |
| Streaming ingestion | [Continuous](https://docs.databricks.com/aws/en/ldp/concepts/pipeline-mode.md#continuous): Processes new data as it arrives in the source.            |
