Cassandra
Apache Cassandra is a distributed wide-column database.
ingestr supports Cassandra as both a source and a destination.
URI format
plaintext
cassandra://user:password@host:9042/keyspaceURI parameters:
user: the username to connect with, optionalpassword: the password for the user, optionalhost: one or more seed hosts. Multiple hosts can be provided with?hosts=host1,host2port: the Cassandra native transport port, default is9042keyspace: the default keyspace, either in the URI path or as?keyspace=...
Optional query parameters:
consistency: one ofone,quorum,local_quorum,all, and other Cassandra consistency namespage_size: source read page sizetimeoutandconnect_timeout: Go duration strings such as10sssl=true: enable TLSdisable_initial_host_lookup=true: useful for single-node Docker or NAT setupsreplication_factor: destination keyspace creation replication factor, default is1
The same URI structure can be used for sources and destinations.
Source table format
Use either a plain table name when the URI includes a keyspace:
plaintext
eventsor a fully qualified table name:
plaintext
analytics.eventsCustom CQL queries are also supported:
plaintext
query:SELECT id, event_type, created_at FROM analytics.events WHERE created_at >= :interval_start ALLOW FILTERINGExample: Load from Cassandra
sh
ingestr ingest \
--source-uri "cassandra://localhost:9042/analytics?disable_initial_host_lookup=true" \
--source-table "events" \
--dest-uri "duckdb:///analytics.duckdb" \
--dest-table "events"Example: Load into Cassandra
Cassandra requires a primary key when creating destination tables. The first primary key is used as the partition key and additional keys are used as clustering keys.
sh
ingestr ingest \
--source-uri "postgres://user:pass@localhost:5432/app" \
--source-table "public.events" \
--dest-uri "cassandra://localhost:9042/analytics?disable_initial_host_lookup=true" \
--dest-table "events" \
--incremental-strategy "merge" \
--primary-key "id"Supported destination strategies are replace, append, merge, and truncate+insert. merge uses Cassandra upsert semantics. delete+insert and scd2 are not supported.