NoSQL Sources
NoSQL sources read from MongoDB, Cassandra, DynamoDB, Cosmos DB, HBase, Elasticsearch, Solr, Firestore, RethinkDB, or CouchDB, one collection or table per asset.
Providers: mongodb | cassandra | dynamodb | cosmosdb | hbase | elasticsearch | solr | firestore | rethinkdb | couchdb
Asset fields
Every asset in this type carries these fields; provider and format values live under options.
| Field | Type | Default | Notes |
|---|---|---|---|
name (required) | string | - | - |
chain | object | - | Per-row iteration over a previously loaded asset. When set, offset is not allowed. |
chain.from (required) | string | - | FQN of a previous asset whose distinct rows drive per-row iteration (e.g. sources.source_name.asset_name). |
chain.pass_columns (required) | boolean | - | When true, prepend the parent row's columns onto every result row produced by that chained iteration. |
chain.prepend_label | string | - | Optional prefix concatenated onto passed parent column names to avoid name conflicts (e.g. 'right_'). |
table | string | - | - |
query | string | - | - |
schema | string | - | Optional schema definition for jdbc-based sources (e.g., psql, mysql, mssql, oracle...). Format: 'field1 type1, field2 type2, ...' or multi-line string for better readability. |
offset | object | - | - |
offset.key (required) | string | - | - |
offset.response_key | string | - | - |
offset.initial_value (required) | string | - | Initial offset value. |
offset.type (required) | timestamp or datetime or date or integer or int or long or id or string or text or cursor or token or page | - | - |
offset.format | string | - | Optional target format used to reformat the value extracted from response_key so it matches the requestParam format expected by the API. Applied only when type is 'timestamp' or 'integer'. For timestamp: 'iso8601' (default), 'epoch_millis', 'epoch_seconds', or any DateTimeFormatter pattern (e.g. 'yyyy-MM-dd'). For integer: any java.util.Formatter pattern (e.g. '%d', '%08d', '%x'). |
Minimal example
A complete nosql source with one asset, written for provider mongodb:
Code
Providers
mongodb
An example for provider mongodb:
Code
Connection
Use settings.connection_name for a saved connection, or configure it inline:
| Field | Type | Default | Notes |
|---|---|---|---|
url (required) | string | - | - |
database (required) | string | - | - |
auth (required) | object | - | - |
auth.user (required) | string | - | - |
auth.password (required) | string | - | - |
Asset options
assets[].options:
| Field | Type | Default | Notes |
|---|---|---|---|
comment | string | - | The comment to append to the read operation. Comments appear in the output of the Database Profiler. |
mode | FAILFAST or PERMISSIVE or DROPMALFORMED | - | The parsing strategy to use when handling documents that don't match the expected schema. FAILFAST: Throws an exception when parsing a document that doesn't match the schema. PERMISSIVE: Sets fields to null when data types don't match the schema. DROPMALFORMED: Ignores any document that doesn't match the schema. Default: FAILFAST. |
column_name_of_corrupt_record | string | - | If you set the mode option to PERMISSIVE, this option specifies the name of the new column that stores the invalid document as extended JSON. Maps to columnNameOfCorruptRecord. |
mongo_client_factory | string | - | MongoClientFactory configuration key. You can specify a custom implementation which must implement the com.mongodb.spark.sql.connector.connection.MongoClientFactory interface. Default: com.mongodb.spark.sql.connector.connection.DefaultMongoClientFactory. Maps to mongoClientFactory. |
partitioner | string | - | The partitioner full class name. You can specify a custom implementation that must implement the com.mongodb.spark.sql.connector.read.partitioner.Partitioner interface. Default: com.mongodb.spark.sql.connector.read.partitioner.SamplePartitioner. |
auto_bucket_partition_field_list | string | - | The list of fields to use for partitioning. The value can be either a single field name or a list of comma-separated fields. Default: _id. Maps to partitioner.options.partition.fieldList. |
auto_bucket_partition_chunk_size | number | - | The average size (MB) for each partition. Smaller partition sizes create more partitions containing fewer documents. Default: 64. Maps to partitioner.options.partition.chunkSize. |
auto_bucket_samples_per_partition | integer | - | The number of samples to take per partition. Default: 100. Maps to partitioner.options.partition.samplesPerPartition. |
auto_bucket_partition_key_projection_field | string | - | The field name to use for a projected field that contains all the fields used to partition the collection. Default: __idx. Maps to partitioner.options.partition.partitionKeyProjectionField. |
partition_field | string | - | The field to use for partitioning, which must be a unique field. Default: _id. Maps to partitioner.options.partition.field. |
partition_size | number | - | The size (in MB) for each partition. Smaller partition sizes create more partitions containing fewer documents. Default: 64. Maps to partitioner.options.partition.size. |
samples_per_partition | integer | - | The number of samples to take per partition. Default: 10. Maps to partitioner.options.samples.per.partition. |
max_partitions_number | integer | - | The number of partitions to create. Default: 64. Maps to partitioner.options.max.number.of.partitions. |
sample_size | integer | - | The number of documents to sample from the collection when inferring the schema. Default: 1000. Maps to sampleSize. |
enable_infer_schema_map_types | boolean | - | Whether to enable Map types when inferring the schema. When enabled, large compatible struct types are inferred to a MapType instead. Default: true. Maps to sql.inferSchema.mapTypes.enabled. |
infer_schema_map_types_min_key_size | integer | - | Minimum size of a StructType before inferring as a MapType. Default: 250. Maps to sql.inferSchema.mapTypes.minimum.key.size. |
allow_disk_use | boolean | - | Specifies whether to allow storage to disk when running the aggregation. Default: true. Maps to aggregation.allowDiskUse. |
output_extended_json | boolean | - | When true, the connector converts BSON types not supported by Spark into extended JSON strings. When false, the connector uses the original relaxed JSON format for unsupported types. Default: false. Maps to outputExtendedJson. |
schema_hints | string | - | Specifies a partial schema of known field types to use when inferring the schema for the collection. Maps to schemaHints. |
stream_lookup_full_document | default or updateLookup | - | Determines what values your change stream returns on update operations. The default setting returns the differences between the original document and the updated document. The updateLookup setting also returns the differences but includes a copy of the entire updated document. Default: default. Maps to change.stream.lookup.full.document. |
stream_lookup_full_document_before_change | default or off or whenAvailable or required | - | Specifies whether to return the full document before the change. Default: false. Maps to change.stream.lookup.full.document.before.change. |
stream_micro_batch_max_partition_count | integer | - | The maximum number of partitions the Spark Connector divides each micro-batch into. Spark workers can process these partitions in parallel. This setting applies only when using micro-batch streams. Default: 1. Maps to change.stream.micro.batch.max.partition.count. |
stream_publish_full_document_only | boolean | - | Specifies whether to publish the changed document or the full change stream document. When this setting is true, the connector filters out messages that omit the fullDocument field and publishes only the value of the field. Default: false. Maps to change.stream.publish.full.document.only. |
stream_startup_mode | latest or timestamp | - | Specifies how the connector starts up when no offset is available. latest: The connector begins processing change events starting with the most recent event. timestamp: The connector begins processing change events at a specified time. Default: latest. Maps to change.stream.startup.mode. |
stream_startup_mode_timestamp | string | - | Specifies the time to start processing change events when using timestamp startup mode. Accepts timestamps in the following formats: An integer representing the number of seconds since the Unix epoch, A date and time in ISO-8601 format with one-second precision, An extended JSON BsonTimestamp. Maps to change.stream.startup.mode.timestamp.start.at.operation.time. |
cassandra
An example for provider cassandra:
Code
Connection
Use settings.connection_name for a saved connection, or configure it inline:
| Field | Type | Default | Notes |
|---|---|---|---|
url (required) | string | - | - |
database (required) | string | - | - |
auth (required) | object | - | - |
auth.user (required) | string | - | - |
auth.password (required) | string | - | - |
Asset options
assets[].options:
| Field | Type | Default | Notes |
|---|---|---|---|
where | string | - | CQL WHERE clause to filter rows. Only supports partition key columns and clustering columns. |
pushdown | boolean | - | Enable or disable predicate pushdown. Default: true. |
split_count | integer | - | Number of Spark partitions to create. If not specified, the connector will determine the optimal number based on the table size. Maps to splitCount. |
split_size | number | - | Target partition size (MB) for Spark partitions. Default: 64. Maps to splitSizeInMB. |
fetch_size | integer | - | The number of rows to fetch at a time. Default: 1000. Maps to fetchSizeInRows. |
consistency_level | ALL or EACH_QUORUM or QUORUM or LOCAL_QUORUM or ONE or TWO or THREE or LOCAL_ONE or ANY or SERIAL or LOCAL_SERIAL | - | Consistency level for read operations. Maps to consistencyLevel. |
reads_throughput | integer | - | Read throughput limit in requests per second per core. Maps to readsPerSec. |
reads_throughput_mb | number | - | Read throughput limit (MB) per second per core. Maps to throughputMBPerSec. |
dynamodb
An example for provider dynamodb:
Code
Connection
Use settings.connection_name for a saved connection, or configure it inline:
| Field | Type | Default | Notes |
|---|---|---|---|
url (required) | string | - | - |
database (required) | string | - | - |
auth (required) | object | - | - |
auth.access_key (required) | string | - | - |
auth.secret_key (required) | string | - | - |
auth.region | string | - | - |
Asset options
assets[].options:
| Field | Type | Default | Notes |
|---|---|---|---|
scan_segments | integer | - | Number of parallel scan segments. Higher values increase parallelism but may consume more read capacity. Maps to scanSegments. |
read_throughput | number | - | Read throughput limit in read capacity units per second. Maps to readThroughput. |
cosmosdb
An example for provider cosmosdb:
Code
Connection
Use settings.connection_name for a saved connection, or configure it inline:
| Field | Type | Default | Notes |
|---|---|---|---|
url (required) | string | - | - |
database (required) | string | - | - |
auth (required) | object | - | - |
auth.account_key (required) | string | - | - |
Asset options
assets[].options:
| Field | Type | Default | Notes |
|---|---|---|---|
read_custom_query | string | - | Custom SQL query to filter documents. If not specified, all documents in the container are read. Maps to spark.cosmos.read.customQuery. |
read_infer_schema_enabled | boolean | - | Enable schema inference from documents. Default: true. Maps to spark.cosmos.read.inferSchema.enabled. |
read_infer_schema_sample_size | integer | - | Number of documents to sample for schema inference. Default: 1000. Maps to spark.cosmos.read.inferSchema.samplingSize. |
read_infer_schema_include_system_properties | boolean | - | Include system properties (_ts, _etag, etc.) in inferred schema. Default: false. Maps to spark.cosmos.read.inferSchema.includeSystemProperties. |
read_partitioning_strategy | Default or Restrictive or Custom | - | Partitioning strategy for reading data. Default: Default. Maps to spark.cosmos.read.partitioning.strategy. |
read_max_item_count | integer | - | Maximum number of items to return per page. Default: 1000. Maps to spark.cosmos.read.maxItemCount. |
hbase
An example for provider hbase:
Code
Connection
Use settings.connection_name for a saved connection, or configure it inline:
| Field | Type | Default | Notes |
|---|---|---|---|
url (required) | string | - | - |
database (required) | string | - | - |
auth | object | - | - |
auth.user | string | - | - |
auth.password | string | - | - |
Asset options
assets[].options:
| Field | Type | Default | Notes |
|---|---|---|---|
use_hbase_context | boolean | false | Whether to use HBaseContext for optimized operations. Default: true. Maps to hbase.spark.use.hbasecontext. |
push_down_predicate | boolean | - | Enable predicate pushdown to HBase. Default: true. Maps to pushDownPredicate. |
timestamp | string | - | Timestamp to use for reading data. Can be a specific timestamp or 'latest'. |
timestamp_range | string | - | Timestamp range for reading data in format 'startTimestamp,endTimestamp'. Maps to timestampRange. |
max_versions | integer | - | Maximum number of versions to return per cell. Maps to maxVersions. |
elasticsearch
An example for provider elasticsearch:
Code
Connection
Use settings.connection_name for a saved connection, or configure it inline:
| Field | Type | Default | Notes |
|---|---|---|---|
url (required) | string | - | - |
database (required) | string | - | - |
auth is one of:
Variant
Variant
Asset options
assets[].options:
| Field | Type | Default | Notes |
|---|---|---|---|
read_metadata | boolean | - | Include document metadata (_id, _index, _type, etc.) in the returned DataFrame. Default: false. Maps to es.read.metadata. |
read_metadata_field | string | - | Field name to store document metadata. Default: _metadata. Maps to es.read.metadata.field. |
read_field_include | string | - | Comma-separated list of fields to include in the result. If not specified, all fields are included. Maps to es.read.field.include. |
read_field_exclude | string | - | Comma-separated list of fields to exclude from the result. Maps to es.read.field.exclude. |
input_max_docs_per_partition | integer | - | Maximum number of documents per partition. Controls parallelism for large datasets. Maps to es.input.max.docs.per.partition. |
nodes_wan_only | boolean | true | Set to true if connecting over WAN or through a load balancer. Disables node discovery. Default: false. Maps to es.nodes.wan.only. |
ssl | boolean | - | Enable SSL/TLS for connections. Default: false. Maps to es.net.ssl. |
solr
An example for provider solr:
Code
Connection
Use settings.connection_name for a saved connection, or configure it inline:
| Field | Type | Default | Notes |
|---|---|---|---|
url (required) | string | - | - |
database (required) | string | - | - |
auth (required) | object | - | - |
auth.user (required) | string | - | - |
auth.password (required) | string | - | - |
Asset options
assets[].options:
| Field | Type | Default | Notes |
|---|---|---|---|
fields | string | - | Comma-separated list of fields to retrieve. Can use field alias syntax (e.g., author |
filters | string | - | Comma-separated list of filter queries to apply (e.g., firstName |
fetch_size | integer | - | Number of rows to retrieve from Solr per request (page size). This is not the maximum number of rows - all matching rows are read. Default: 1000. Maps to rows. |
max_rows | integer | - | Limits the result set to a maximum number of rows. Only applies when using /select handler. Should not be used for large values. Default: None. |
request_handler | string | - | Solr request handler for queries. Use /export handler to stream data out of Solr (requires fields to be explicitly specified). Default: /select. |
splits | boolean | - | Enable shard splitting on default field version to increase parallelism when Spark cluster has more executor slots than shards. Default: false. |
split_field | string | - | Field to split on for intra-shard splitting. Should have sufficient variance in values. Default: version. |
splits_per_shard | integer | - | Number of splits per shard for increased parallelism. This is a hint and actual splits may vary. Default: 1. |
flatten_multivalued | boolean | - | Flatten multi-valued fields from Solr. Default: true. |
doc_values | boolean | - | Fetch docValues that are indexed but not stored by using function queries. Should be used for Solr versions lower than 5.5.0. Default: false. Maps to dv. |
skip_non_doc_values | boolean | - | Skip all fields that are not docValues. Default: false. Maps to skip_non_dv. |
sample_seed | integer | - | Read a random sample of documents from Solr using the specified seed. When provided, a 10% sample is read by default (use sample_pct to control). Default: None. |
sample_pct | number | - | Size of random sample as a value between 0 and 1. Used with sample_seed. Default: 0.1. |
solr_params | string | - | Arbitrary Solr parameters in the form of a Solr query string (e.g., fq=userId:[10 TO 1000]). Use only for parameters NOT covered by other options. Maps to solr.params. |
partition_by | string | - | Set to 'time' to query multiple time series collections partitioned according to time period. |
time_period | string | - | Time period format: X DAYS/HOURS/MINUTES (e.g., 1MINUTES). Should match the time period with which partitions are created. Default: 1DAYS. |
datetime_pattern | string | - | DateTime pattern for time series partitions. Can be inferred from time_period. Default: yyyy_MM_dd. |
timestamp_field_name | string | - | Field name in indexed documents where timestamp is found. Default: timestamp_tdt. |
timezone_id | string | - | Timezone ID for time series queries. Default: UTC. |
max_active_partitions | integer | - | Maximum number of partitions allowed at a time for time series queries. Default: null. |
firestore
An example for provider firestore:
Code
Connection
Use settings.connection_name for a saved connection, or configure it inline:
| Field | Type | Default | Notes |
|---|---|---|---|
project_id (required) | string | - | - |
database (required) | string | - | - |
url | string | - | - |
auth | object | - | Firestore auth. Provide service_account_json for GCP; omit for the emulator or to use Application Default Credentials. |
auth.service_account_json (required) | string | - | Inline GCP service account JSON. |
Asset options
assets[].options:
| Field | Type | Default | Notes |
|---|---|---|---|
order_by | string | - | Field name to order results by. Maps to orderBy. |
limit_to_first | integer | - | Limit the number of results returned, starting from the first. Maps to limitToFirst. |
limit_to_last | integer | - | Limit the number of results returned, starting from the last. Maps to limitToLast. |
rethinkdb
An example for provider rethinkdb:
Code
Connection
Use settings.connection_name for a saved connection, or configure it inline:
| Field | Type | Default | Notes |
|---|---|---|---|
url (required) | string | - | - |
database (required) | string | - | - |
auth (required) | object | - | - |
auth.user (required) | string | - | - |
auth.password (required) | string | - | - |
Asset options
assets[].options:
| Field | Type | Default | Notes |
|---|---|---|---|
timeout | integer | - | Connection timeout in seconds. Default: 20. |
read_mode | single or majority or outdated | - | Read mode for queries. Default: single. Maps to readMode. |
couchdb
An example for provider couchdb:
Code
Connection
Use settings.connection_name for a saved connection, or configure it inline:
| Field | Type | Default | Notes |
|---|---|---|---|
url (required) | string | - | - |
database (required) | string | - | - |
auth (required) | object | - | - |
auth.user (required) | string | - | - |
auth.password (required) | string | - | - |