Keyspace qualifier

Sometimes issuing a USE statement to select a keyspace is inconvenient. Connection pooling requires managing multiple keyspaces. To simplify tracking multiple keyspaces, use the keyspace qualifier instead of the USE statement. You can specify the keyspace using the keyspace qualifier (dot notation) in these statements:

  • ALTER TABLE

  • CREATE TABLE

  • DELETE

  • INSERT

  • SELECT

  • TRUNCATE

  • UPDATE

    1. To specify a table when you are not located in the keyspace that contains the table, specify the name of the keyspace followed by a period, then the table name. For example, cycling.race_winners, where cycling is the keyspace and race_winners is the table name.

      INSERT INTO cycling.race_winners (
        race_name, race_position,
        cyclist_name
      ) VALUES (
        'National Championships South Africa WJ-ITT (CN)', 1,
        { firstname:'Frances', lastname:'DU TOUT' }
      );
      
      INSERT INTO cycling.race_winners (
        race_name, race_position,
        cyclist_name
      ) VALUES (
        'National Championships South Africa WJ-ITT (CN)', 2,
        { firstname:'Lynette', lastname:'BENSON' }
      );
      
      INSERT INTO cycling.race_winners (
        race_name, race_position,
        cyclist_name
      ) VALUES (
        'National Championships South Africa WJ-ITT (CN)', 3,
        { firstname:'Anja', lastname:'GERBER' }
      );
      
      INSERT INTO cycling.race_winners (
        race_name, race_position,
        cyclist_name
      ) VALUES (
        'National Championships South Africa WJ-ITT (CN)', 4,
        { firstname:'Ame', lastname:'VENTER' }
      );
      
      INSERT INTO cycling.race_winners (
        race_name, race_position,
        cyclist_name
      ) VALUES (
        'National Championships South Africa WJ-ITT (CN)', 5,
        { firstname:'Danielle', lastname:'VAN NIEKERK' }
      );

Was this helpful?

Give Feedback

How can we improve the documentation?

© 2024 DataStax | Privacy policy | Terms of use

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.

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