• Glossary
  • Support
  • Downloads
  • DataStax Home
Get Live Help
Expand All
Collapse All

DataStax Pulsar Connector

    • Getting Started
      • About the DataStax Apache Pulsar™ Connector
        • System requirements
      • Pulsar Connector release notes
      • Installing DataStax Apache Pulsar™ Connector
      • Pulsar Connector single instance quick start
    • Guides and examples
      • Configuration
        • Configuring parallelism
        • Specify writetime timestamp column
        • Setting row-level TTL values from Pulsar fields
        • Pass Pulsar Connector settings directly to the DataStax Java driver
        • Mapping pulsar topics to database tables
          • Determining topic data structure
          • Mapping basic messages to table columns
          • Mapping a message that contain JSON fields
            • Mapping a message that contains both basic and JSON fields
            • Mapping JSON messages
          • Mapping Avro messages
          • Extract Pulsar record header values
          • Mapping messages to table that has a User Defined Type
          • Mapping a topic to multiple tables
          • Multiple topics to multiple tables
          • Provide CQL queries in mappings
          • The now() function in mappings
      • Operations
        • About operating and maintaining the DataStax Connector
        • Scaling the DataStax Apache Pulsar™ Connector
        • Changing the topic or table schema
        • Restarting the DataStax Apache Pulsar™ Connector
        • Displaying the DataStax Apache Pulsar™ Connector configuration
        • Updating the DataStax Apache Pulsar™ Connector configuration
        • Deleting the DataStax Apache Pulsar™ Connector
        • Getting the DataStax Connector status
      • Security
        • Using internal or LDAP authentication
      • DataStax Apache Pulsar™ Connector metrics
      • Troubleshooting
        • Record fails to write
        • Writing fails because of mutation size
        • Data parsing fails
        • Loading balancing datacenter is not specified
    • Reference
      • DataStax Apache Pulsar™ Connector details
      • DataStax connection
      • Pulsar topic-to-table settings
      • Converting date and times for a topic
      • Using the DataStax Apache Pulsar™ Connector with DataStax Enterprise authentication
        • Internal or LDAP authentication
      • SSL encrypted connection
      • Configure error handling
  • DataStax Pulsar Connector
  • Guides and examples
  • Configuration
  • Mapping pulsar topics to database tables
  • Provide CQL queries in mappings

Provide CQL queries in mappings

In the Pulsar topic mapping, you can optionally provide a CQL query that should run when the new record arrives on the Pulsar topic.

This feature is only meant for advanced use cases. Most often, you can use the standard Pulsar mapping without a query. If you define a query in the topic-to-table mapping, the query has priority and will be used instead of the automatically generated action.

If used, you must provide the bound variables used in the query in the mapping column. For example, give the following query:

topic:
  my_topic:
    my_ks:
      my_table:
        query: 'INSERT INTO %s.types (bigintCol, intCol) VALUES (:some_name, :some_name_2)'

The corresponding mapping in this example should be defined as:

topic:
  my_topic:
    my_ks:
      my_table:
        mapping: 'some_name=value.bigint, some_name_2=value.int'

Additional examples of CQL queries that you could include with the topic-to-table mapping:

topic:
  my_topic:
    my_ks:
      my_table:
        query: 'INSERT INTO ks.tbl(pkey,ccol,x) VALUES :pkey, :ccol, :x);'
        query: 'INSERT INTO ks.tbl(pkey,ccol,x) VALUES (:pkey, :ccol, :x) USING TTL :input_ttl'
        query: 'INSERT INTO ks.tbl(pkey,ccol,x) VALUES (:pkey, :ccol, :x) USING TIMESTAMP :input_ts'
        query: 'UPDATE ks.tbl SET somelist = somelist + [:newitem] WHERE pkey = :pkey'
        query: 'DELETE FROM ks.tbl WHERE pkey = :pkey AND ccol = :ccol;'
        query: 'DELETE FROM ks.tbl WHERE pkey = :pkey AND ccol > :ccol1 AND ccol <= :ccol2;'
Multiple topics to multiple tables The now() function in mappings

General Inquiries: +1 (650) 389-6000 info@datastax.com

© DataStax | Privacy policy | Terms of use

DataStax, Titan, and TitanDB are registered trademarks of DataStax, Inc. and its subsidiaries in the United States and/or other countries.

Apache, Apache Cassandra, Cassandra, Apache Tomcat, Tomcat, Apache Lucene, Apache Solr, Apache Hadoop, Hadoop, Apache Pulsar, Pulsar, Apache Spark, Spark, Apache TinkerPop, TinkerPop, Apache Kafka and Kafka are either registered trademarks or trademarks of the Apache Software Foundation or its subsidiaries in Canada, the United States and/or other countries.

Kubernetes is the registered trademark of the Linux Foundation.

landing_page landingpage