Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,16 @@ public interface BigQueryToLakehouseYaml {

@TemplateParameter.Text(
order = 3,
name = "rowRestriction",
optional = true,
description = "Optional SQL text filtering statement for reading from BigQuery.",
helpText =
"Optional SQL text filtering statement, similar to a WHERE clause in a query. Aggregates are not supported. Restricted to a maximum length of 1 MB.",
example = "age > 18")
String getRowRestriction();

@TemplateParameter.Text(
order = 4,
name = "lakehouseTable",
optional = false,
description = "A fully-qualified table identifier.",
Expand All @@ -77,7 +87,7 @@ public interface BigQueryToLakehouseYaml {
String getLakehouseTable();

@TemplateParameter.Text(
order = 4,
order = 5,
name = "lakehouseCatalogProperties",
optional = true,
description = "Properties used to set up the Lakehouse catalog.",
Expand All @@ -86,7 +96,7 @@ public interface BigQueryToLakehouseYaml {
String getLakehouseCatalogProperties();

@TemplateParameter.Text(
order = 5,
order = 6,
name = "lakehouseConfigProperties",
optional = true,
description = "Properties passed to the Hadoop Configuration.",
Expand All @@ -95,7 +105,7 @@ public interface BigQueryToLakehouseYaml {
String getLakehouseConfigProperties();

@TemplateParameter.Text(
order = 6,
order = 7,
name = "lakehousePartitionFields",
optional = true,
description = "Fields used to create a partition spec for new tables.",
Expand All @@ -104,7 +114,7 @@ public interface BigQueryToLakehouseYaml {
String getLakehousePartitionFields();

@TemplateParameter.Text(
order = 7,
order = 8,
name = "lakehouseTableProperties",
optional = true,
description = "Lakehouse table properties to be set on table creation.",
Expand All @@ -113,7 +123,7 @@ public interface BigQueryToLakehouseYaml {
String getLakehouseTableProperties();

@TemplateParameter.Text(
order = 8,
order = 9,
name = "lakehouseCatalogName",
optional = false,
description = "Name of the catalog containing the table.",
Expand All @@ -123,7 +133,7 @@ public interface BigQueryToLakehouseYaml {
String getLakehouseCatalogName();

@TemplateParameter.Text(
order = 9,
order = 10,
name = "lakehouseDrop",
optional = true,
description = "A list of field names to drop from the input record before writing.",
Expand All @@ -132,7 +142,7 @@ public interface BigQueryToLakehouseYaml {
String getLakehouseDrop();

@TemplateParameter.Text(
order = 10,
order = 11,
name = "lakehouseKeep",
optional = true,
description = "A list of field names to keep in the input record.",
Expand All @@ -141,7 +151,7 @@ public interface BigQueryToLakehouseYaml {
String getLakehouseKeep();

@TemplateParameter.Text(
order = 11,
order = 12,
name = "lakehouseOnly",
optional = true,
description = "The name of a single record field that should be written.",
Expand All @@ -150,7 +160,7 @@ public interface BigQueryToLakehouseYaml {
String getLakehouseOnly();

@TemplateParameter.Text(
order = 12,
order = 13,
name = "lakehouseDistributionMode",
optional = true,
description = "Defines distribution of write data.",
Expand All @@ -160,7 +170,7 @@ public interface BigQueryToLakehouseYaml {
String getLakehouseDistributionMode();

@TemplateParameter.Boolean(
order = 13,
order = 14,
name = "lakehouseAutosharding",
optional = true,
description =
Expand Down
10 changes: 10 additions & 0 deletions yaml/src/main/python/options/bigquery_options.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,16 @@ options:
example: '["field1", "field2"]'
required: false
type: text
- order: 2
name: "rowRestriction"
description: "Optional SQL text filtering statement for reading from BigQuery."
help: >
Optional SQL text filtering statement, similar to a WHERE clause in a
query. Aggregates are not supported. Restricted to a maximum length of
1 MB.
example: "age > 18"
required: false
type: text

- name: "bigquery_write_options"
parameters:
Expand Down
3 changes: 3 additions & 0 deletions yaml/src/main/yaml/BigQueryToLakehouse.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@ pipeline:
{% if fields %}
fields: {{ fields }}
{% endif %}
{% if rowRestriction %}
row_restriction: {{ rowRestriction }}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

In Jinja-templated YAML configurations, optional parameters like rowRestriction should be wrapped in {% if %} blocks. This ensures that both unset and empty-string inputs omit the key cleanly, preventing validation or parsing errors from empty values, while also ensuring the string is properly quoted.

{% if rowRestriction %}
        row_restriction: "{{ rowRestriction }}"
{% endif %}
References
  1. In Jinja-templated YAML configurations, wrap optional parameters in {% if %} blocks to ensure that both unset and empty-string inputs omit those keys cleanly, preventing validation or parsing errors from empty values.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

row_restriction is already wrapped in {% if rowRestriction %} ... {% endif %} here. It is intentionally left unquoted (matching filter: {{ filter }} and query: {{ query }} across the other SQL/Iceberg YAML blueprints) because BigQuery SQL expressions can legitimately contain double-quoted string literals (e.g. status = "ACTIVE"), which would cause a YAML syntax error inside double quotes.

{% endif %}

- type: WriteToLakehouse
name: WriteToLakehouse
Expand Down
Loading