Connectors#

Google Cloud connectors for Apache Flink.

Choosing an API#

The Table connectors map onto the DataStream connectors with the same names, but the two APIs describe jobs at different levels.

APIChoose it when
DataStream APIA Java job needs connector builders, connector-specific serialization or deserialization schemas, per-record destinations, or a connector feature with no SQL option
Table API and SQLA job is expressed as relational tables and needs DDL, SQL type mappings, or metadata columns

The Table page for a connector documents its DDL, SQL types, metadata columns, and planner-specific restrictions. The corresponding DataStream page documents the underlying runtime behavior and builder-only features.

Start with Delivery guarantees when checkpoint durability, replay behavior, or exactly-once delivery determines which sink method to use.

See Lineage for configured physical-resource metadata, SQL catalog identities, listener deployment and Flink-version limits.

The connector types named on these pages are documented in the Java API reference.

What a builder checks#

A setter rejects a value when doing so tells you more than the service’s own refusal would:

Rejected when you set itWhich values
Missing, or nullEvery required option
Empty, or nothing but whitespaceEvery configured name, id or file path. Row-key values are the exception: an empty prefix means “scan the whole table”
A /, a whole value of . or .., or leading or trailing whitespaceA component the connector concatenates into a resource path: project, dataset, table, instance, database, databaseId, topic, subscription, location, queue, parentProject, queryResultDataset, tempDataset
Not matching the grammar the connector will read it byA value it parses itself: an emulator endpoint’s host:port, a Spanner identifier’s quoting, a row-range or row-key literal, a gs:// staging path, a Cloud Tasks relative URI, an additional field’s protobuf name, a Firestore document path

The / rule is about addressing rather than spelling. A component with a / in it does not fail — it silently names a different resource, and the service then answers accurately about something you never typed. A component that is exactly . or .. is path navigation for the same reason, while a dot inside a name is the service’s to judge. A value that genuinely is a full path, such as Pub/Sub’s kmsKeyName, is exempt for the same reason.

Two more checks exist because of where the service’s own answer would land. A Cloud Tasks target URL must be absolute, checked at the builder for a fixed URL and again per record for one an extractor produced, so the rejection names the URL rather than the request that carried it. And a reserved App Engine header such as Host is refused at the setter because it is owned by Cloud Tasks and cannot take effect, which is worth learning where you set it.

Everything else about a name is the service’s answer, including whether the resource exists and whether the name is one that service accepts. Its rejection names the resource it refused. A copy of those naming rules kept here would go stale in the direction that hurts, refusing a name the service would have taken.

Upgrading the connector#

Upgrade the connector by restoring the job’s state into a job graph that the new connector release builds. Stop the job with a savepoint and resubmit it with -s, or, with the Flink Kubernetes Operator, deploy the application with upgradeMode: savepoint or last-state. Each of these builds a new job graph from the new jar. The connectors’ checkpoint state is versioned, so the new release reads the state the old one wrote, and upgradeMode: stateless is never needed for a connector upgrade. Discarding state is also unsafe for some sinks, such as the BigQuery exactly-once sink.

A JobManager that recovers its persisted job graph after the connector under it has changed is not supported. That graph was serialized by the old release and is read by the new one. Examples are kubectl set image on the JobManager deployment, recreating a cluster under the same cluster id with its high-availability ConfigMaps kept, and changing the image of an Operator session cluster while jobs run on it. With high availability enabled, the Operator redeploys a session cluster with its high-availability data kept, so each running job resumes from its old graph. Stop each job on a session cluster with a savepoint before changing the connector in its image or lib/, then resubmit the jobs. A JobManager in this state may fail to deserialize the graph. It may also run the job with a setting the old release did not have read as false or 0 rather than its documented default. Resubmitting from a savepoint or the latest retained checkpoint recovers the job.

Run the same connector release wherever a job graph is built and run. Outside application mode, the CLI, SQL Client or SQL Gateway builds the job graph, and the cluster deserializes it. When both load the connector from their own lib/ directories, Flink does not check that the two copies are the same release. A mismatch has the effects above, and a cluster older than the client also ignores any setting it does not have. Shipping the connector with the job instead of placing it in lib/ (inside the job jar, with the SQL Client’s --jar, or with ADD JAR), or running in application mode, leaves one copy, so the question does not arise.