In the below properties casscatalog is the Catalog name we are assigning to Cassandra host.


spark.sql.catalog.casscatalog com.datastax.spark.connector.datasource.CassandraCatalog   

spark.sql.catalog.casscatalog.spark.cassandra.connection.host <host>         //can be multiple host for cluster 

spark.sql.catalog.casscatalog.spark.cassandra.connection.port 9042

spark.sql.catalog.casscatalog.spark.cassandra.auth.username username

spark.sql.catalog.casscatalog.spark.cassandra.auth.password password


//if SSL is Required add below properties

spark.sql.catalog.casscatalog.spark.cassandra.connection.ssl.enabled true

spark.sql.catalog.casscatalog.spark.cassandra.connection.ssl.trustStore.path <path to truststorefile>

spark.sql.catalog.casscatalog.spark.cassandra.connection.ssl.trustStore.password password 


Now we can query the table with a filter using primary keys using sql component.


SELECT cust_id from casscatalog.keyspacename.tablename where key ='saint barthelemy'


Reference :https://github.com/datastax/spark-cassandra-connector/blob/master/doc/14_data_frames.md#pushing-down-clauses-to-cassandra 

https://github.com/datastax/spark-cassandra-connector/blob/master/doc/reference.md#cassandra-connection-parameters

https://github.com/datastax/spark-cassandra-connector/blob/master/doc/1_connecting.md

https://docs.datastax.com/en/dse/6.7/dse-dev/datastax_enterprise/spark/sparkPredicatePushdown.html