CertSafari
    Snowflake SnowPro Advanced: Data Engineer (DEA-C02)· Lessons

    Domain 1 · Lesson 5/22

    Spark, Python and native connectors for Snowflake

    Install, configure, and use connectors for Snowflake integration.

    10 min read
    4% of exam
    9 sources
    Published 20 Oct 2026
    Docs as of 18 Oct 2026

    What you will be able to do

    • Choose between internal and external transfer for the Spark connector and handle the clean-up each one needs
    • Explain what Spark query pushdown sends to Snowflake and what it cannot
    • Install the Python connector, connect, run statements with cursors and fetch results into pandas
    • Install a native connector from the Marketplace and tell pull-based from push-based designs

    1.The Spark connector as a plugin in the Spark cluster

    Snowflake provides connectors for three more kinds of client besides Kafka. Spark jobs use a plugin. Python applications use a database API library. Native connectors run inside Snowflake itself. The Snowflake Connector for Spark makes Snowflake look like any other Spark data source: you can fill a DataFrame from a Snowflake table or query, and write a DataFrame back to a table. It runs as a Spark plugin, shipped as the spark-snowflake package. The Spark cluster can be self-hosted or run on a service such as AWS EMR, Databricks or Qubole. Underneath, the connector uses Scala 2.12.x or 2.13.x and talks to Snowflake through the Snowflake JDBC driver.

    Which connector version you need depends on your Spark version. Connector 2.x covers Spark 3.2 to 3.4, with a separate build for each Spark version. Connector 3.x covers Spark 3.2 to 4.1, and one package works with most of them. A plain third-party JDBC driver can also connect Spark to Snowflake. The connector is recommended because it is tuned for moving large amounts of data and it supports query pushdown. It also has one job nothing else does: enforcing row access and masking policies on Iceberg tables queried from Spark through Horizon Catalog. That requires version 3.1.6 or later.

    Checkpoint 1 of 5· Check yourself

    A data engineering team queries Apache Iceberg tables from their Spark cluster through Snowflake Horizon Catalog. Row access and masking policies are set on those tables, and the team must make sure the policies are enforced when Spark reads the data. What should they use?

    Sources12

    2.Internal vs external transfer modes

    The two Spark connector transfer modes
    AspectInternal transferExternal transfer
    Storage locationTemporary internal stage created and managed by SnowflakeS3 bucket or Azure Blob container created and managed by you
    LifecycleStage created when the session starts and dropped when it endsFiles remain until deleted manually, by the purge parameter, or by a storage lifecycle policy
    Minimum connector version2.2.0 (AWS), 2.4.0 (Azure), 2.7.0 (GCP)Any version; Azure needs 2.4.0
    Column mapping (columnmapping)SupportedNot supported
    When to chooseThe default recommendationConnector 2.1.x or lower, or transfers likely to run 36 hours or more

    Use internal transfer unless a constraint rules it out. The internal stage needs no setup and leaves nothing behind. It does rely on temporary credentials that expire after 36 hours, so a transfer expected to run longer than that, or an old connector without internal support, needs external transfer. External transfer requires you to create and configure the storage location as part of installing the connector. If your Spark column names differ from the Snowflake ones, the columnmapping parameter can map them, but only during internal transfer.

    Checkpoint 2 of 5· Check yourself

    A Spark backfill job that writes a very large DataFrame to Snowflake is expected to run for about 40 hours. The cluster uses Spark connector 3.x on AWS. Which transfer setup should the team choose?

    Sources2

    3.Query pushdown from Spark into Snowflake

    Query pushdown means the work happens in Snowflake rather than in the Spark cluster. The connector does not pull raw rows into Spark and filter them there. Instead it translates large, complex Spark logical plans, whole or in part, into work that Snowflake runs, so only the data Spark actually needs crosses between the systems. Pushdown has been available since connector version 2.1.0.

    Pushdown does not cover every operation. A Spark UDF, for example, cannot be pushed down. Any step that calls one runs in Spark, and the data it needs has to be transferred out first. If you need every operation pushed down, Snowpark is the alternative. It runs the whole job inside Snowflake rather than in a separate Spark cluster, and it pushes down all operations, including Snowflake UDFs. For enforcing row and column policies on Iceberg tables, the Spark connector is still the tool to use.

    Checkpoint 3 of 5· Check yourself

    Profiling shows that most of a Spark job's runtime goes to one step: a Spark UDF applied to rows read from Snowflake through Spark connector 3.x. The team wants the work in that step done by Snowflake rather than by the Spark cluster. Which change does that?

    Sources2

    4.Python connector: install, connect, query, fetch into pandas

    The Snowflake Connector for Python gives Python applications what the JDBC and ODBC drivers give Java and C/C++ applications. Install snowflake-connector-python with pip on Linux, macOS or Windows. It requires Python 3.11 or later. Since version 5.0 the connector is built on the Universal Core, but its public interface is still the snowflake.connector module, with PEP 249 Connection and Cursor objects.

    Opening a connection with login parameters and a default warehouse, database and schemapython
    conn = snowflake.connector.connect(
        user=USER,
        password=PASSWORD,
        account=ACCOUNT,
        warehouse=WAREHOUSE,
        database=DATABASE,
        schema=SCHEMA
        )

    You can keep credentials out of your code with a connections.toml file. The connector looks for ~/.snowflake/connections.toml first, or in the directory set by SNOWFLAKE_HOME, and then in an OS-specific location. A named connection in that file accepts the same options as connect(). Authentication uses the default authenticator, or federated authentication if it is enabled. Session parameters such as QUERY_TAG can be passed at connect time through session_parameters, or set afterwards with ALTER SESSION.

    All work goes through cursors. conn.cursor().execute(...) runs DDL, DML and queries, including setup statements such as USE WAREHOUSE. For bulk loads, PUT the local files to an internal stage and then run COPY INTO <table>, rather than inserting rows one at a time. For analysis, call fetch_pandas_all() or fetch_pandas_batches() on a cursor to get a pandas DataFrame back. To go the other way, use write_pandas(), or DataFrame.to_sql() with pd_writer. One type surprise: an integer column (FIXED NUMERIC with scale 0) that contains a NULL arrives as float64.

    Checkpoint 4 of 5· Check yourself

    A Python script using snowflake-connector-python has to load about a hundred CSV files from /tmp/data on the machine where it runs into an existing table. Which approach matches the bulk-load pattern Snowflake recommends for the connector?

    Sources3456

    5.Native connectors: ingestion apps that run inside Snowflake

    A native connector is a connector application built and deployed with the Snowflake Native App Framework. It brings data from an external system into Snowflake, and providers, Snowflake or third parties, publish it on the Snowflake Marketplace. Unlike the Kafka and Spark connectors, its ingestion logic runs inside your Snowflake account and not on a cluster you operate. How it reaches the source depends on the pattern it follows.

    Pull-based vs push-based native connectors
    AspectPull-basedPush-based
    What runs whereThe Native App reaches out to the source through external access, fetches data directly into your account and processes it based on your configurationAn agent in your environment sends initial and incremental loads; the Native App manages replication, controls the agent and creates the target databases
    External componentNoneAn agent, distributed as a Docker image, that reads a source CDC stream
    Fits whenThe source has well-documented APIs you can callInbound access through your firewall isn't feasible
    Snowflake Native SDK for ConnectorsSupportedNot supported

    If a team wants no external server or agent host to install and patch, a pull-based native connector fits: nothing runs outside Snowflake. A push-based connector moves part of the work back into your network, because you deploy and run the agent container there.

    Installation happens in Snowsight. Go to Marketplace » Snowflake Marketplace, open the listing and review the privileges it requests. Then select Get, choose the warehouse to install with, and optionally name the app. You need ACCOUNTADMIN, or a role with IMPORT SHARE and CREATE APPLICATION. Installing creates an APPLICATION object and runs the app's setup script. The connector does not work yet at that point: you still have to approve its App Specs and grant it the data access it asks for. The role you install with becomes the app's owner. If that role is dropped, the app stops working and has to be reinstalled, so use GRANT OWNERSHIP to move ownership first. Other users get access through application roles.

    Checkpoint 5 of 5· Check yourself

    Security policy forbids any inbound connection through the company firewall to an on-premises source database. The team wants a Marketplace native connector to replicate that database's changes into Snowflake. Which setup fits?

    Sources789

    Sources

    (9)

    Every claim above is drawn from one of these pages, quoted as it was written on the date shown.

    1. 1.
      “The connector runs as a Spark plugin and is provided as a Spark package (spark-snowflake).”
      ↩︎ The Spark connector as a plugin in the Spark cluster
      “Each Spark Connector 3 package supports most versions of Spark.”
      ↩︎ The Spark connector as a plugin in the Spark cluster
      “To enable this enforcement, you must install 3.1.6 or a later version of the Spark connector.”
      ↩︎ Checkpoint
    2. 2.
      “uses the Snowflake JDBC driver to communicate with Snowflake.”
      ↩︎ The Spark connector as a plugin in the Spark cluster
      “Internal transfer uses a temporary location created and managed internally/transparently by Snowflake.”
      ↩︎ Internal vs external transfer modes
      “internal transfer uses temporary credentials that expire after 36 hours”
      ↩︎ Internal vs external transfer modes
      “Column mapping is supported only for internal data transfer.”
      ↩︎ Internal vs external transfer modes
      “enabling large and complex Spark logical plans (in their entirety or in parts) to be processed in Snowflake”
      ↩︎ Query pushdown from Spark into Snowflake
      “Query pushdown is supported in Version 2.1.0 (and higher) of the Snowflake Connector for Spark.”
      ↩︎ Query pushdown from Spark into Snowflake
      “Snowpark also supports pushdown of all operations, including Snowflake UDFs.”
      ↩︎ Query pushdown from Spark into Snowflake
      “the connector does not automatically delete the files from the storage location.”
      ↩︎ Exam trap 1
      “Pushdown is not possible in all situations. For example, Spark UDFs cannot be pushed down to Snowflake.”
      ↩︎ Exam trap 2
      “the connector does not automatically delete the files from the storage location.”
      ↩︎ Prediction
      “Your transfer is likely to take 36 hours or more (internal transfer uses temporary credentials that expire after 36 hours).”
      ↩︎ Checkpoint
      “If you need pushdown for all operations, consider writing your code to use Snowpark API instead. Snowpark also supports pushdown of Snowflake UDFs.”
      ↩︎ Checkpoint
    3. 3.
      “It can be installed using pip on Linux, macOS, and Windows where Python 3.11 or later is installed.”
      ↩︎ Python connector: install, connect, query, fetch into pandas
    4. 4.
      “Connection definitions support the same configuration options available in the snowflake.connector.connect method.”
      ↩︎ Python connector: install, connect, query, fetch into pandas
      “connect using either the default authenticator or federated authentication (if enabled).”
      ↩︎ Python connector: install, connect, query, fetch into pandas
    5. 5.
      “you use a Cursor to retrieve the data and then call one of these Cursor methods to put the data into a pandas DataFrame:”
      ↩︎ Python connector: install, connect, query, fetch into pandas
    6. 6.
      “first use the PUT command to stage the file in an internal location, then use the COPY INTO <table> command”
      ↩︎ Python connector: install, connect, query, fetch into pandas
      “first use the PUT command to stage the file in an internal location, then use the COPY INTO <table> command to copy the data”
      ↩︎ Checkpoint
    7. 7.
      “A native connector is a connector application built and deployed using the Snowflake Native App Framework.”
      ↩︎ Native connectors: ingestion apps that run inside Snowflake
      “A native connector uses direct external access to connect with the source application.”
      ↩︎ Native connectors: ingestion apps that run inside Snowflake
      “An agent is a standalone application, distributed as a Docker image, that is deployed in a customer environment”
      ↩︎ Native connectors: ingestion apps that run inside Snowflake
      “Using a push-based pattern is effective when inbound access to the source application through a customer firewall is not feasible”
      ↩︎ Checkpoint
    8. 8.
      “To access a listing, you must use the ACCOUNTADMIN role or another role with the IMPORT SHARE and CREATE APPLICATION privileges.”
      ↩︎ Native connectors: ingestion apps that run inside Snowflake
    9. 9.
      “The role you use to install a Snowflake Native App becomes the owner of the APPLICATION object.”
      ↩︎ Native connectors: ingestion apps that run inside Snowflake
      “you will need to approve any App Specs and configure the explicit data access grants the app needs”
      ↩︎ Native connectors: ingestion apps that run inside Snowflake

    Spotted a mistake, or was something unclear? Tell us.