risingwavelabs/risingwave · error · SinkError::Config

database is required for Snowflake JDBC sink

Error message

database is required for Snowflake JDBC sink

What it means

In `SnowflakeSink::new`, the `snowflake_database` config field is required; when absent the constructor returns this Config error. The Snowflake JDBC sink needs the target database to qualify the schema, table, and stage objects it writes to.

Source

Thrown at src/connector/src/sink/snowflake_redshift/snowflake.rs:591

        Ok(SinkCommitCoordinator::SinglePhase(Box::new(coordinator)))
    }
}

pub enum SnowflakeSinkWriter {
    S3(SnowflakeRedshiftSinkS3Writer),
    Jdbc(SnowflakeRedshiftSinkJdbcWriter),
}

impl SnowflakeSinkWriter {
    pub async fn new(
        config: SnowflakeV2Config,
        is_append_only: bool,
        writer_param: SinkWriterParam,
        param: SinkParam,
    ) -> Result<Self> {
        let schema = param.schema();
        let database = config.snowflake_database.ok_or_else(|| {
            SinkError::Config(anyhow!("database is required for Snowflake JDBC sink"))
        })?;
        let schema_name = config.snowflake_schema.ok_or_else(|| {
            SinkError::Config(anyhow!("schema is required for Snowflake JDBC sink"))
        })?;
        let table_name = config.snowflake_target_table_name.ok_or_else(|| {
            SinkError::Config(anyhow!("table.name is required for Snowflake JDBC sink"))
        })?;
        if config.with_s3 {
            let s3_writer = SnowflakeRedshiftSinkS3Writer::new(
                config.s3_inner.ok_or_else(|| {
                    SinkError::Config(anyhow!(
                        "S3 configuration is required for Snowflake S3 sink"
                    ))
                })?,
                schema,
                is_append_only,
                table_name,
            )?;

View on GitHub (pinned to 6469eb736d)

Solutions

  1. Add `snowflake.database = '<db>'` to the sink WITH options
  2. Verify option spelling matches the connector's expected keys (`snowflake.database`)
  3. Check the connector docs for the full required option set (database, schema, table.name)

Example fix

-- before
WITH (connector='snowflake', snowflake.schema='public', snowflake.table.name='t', ...)
-- after
WITH (connector='snowflake', snowflake.database='MYDB', snowflake.schema='public', snowflake.table.name='t', ...)
Defensive patterns

Strategy: validation

Validate before calling

let required = ["snowflake.database", "snowflake.schema", "snowflake.table.name"];
for k in required {
    assert!(opts.contains_key(k), "missing sink option: {k}");
}

Prevention

When it happens

Trigger: Creating a Snowflake sink whose WITH options omit `snowflake.database`, causing `config.snowflake_database` to be None in `new`.

Common situations: Copying a sink DDL example that only sets user/warehouse; renaming of options between versions; typos like `database` instead of `snowflake.database`.

Understand the failure class

Background: "is required", "must be set", "missing required field": configuration validation errors across open-source libraries — this error's family across 36 libraries.

Related errors


AI-assisted analysis of risingwavelabs/risingwave@6469eb736d (2026-09-11). Data as JSON: /api/errors/dfc8459be08a296d. Report an issue: GitHub.