ScyllaDB University Live | Free Virtual Training Event
Learn more
ScyllaDB Documentation Logo Documentation
  • Server
  • Cloud
  • Tools
    • ScyllaDB Manager
    • ScyllaDB Monitoring Stack
    • ScyllaDB Operator
  • Drivers
    • CQL Drivers
    • DynamoDB Drivers
  • Resources
    • ScyllaDB University
    • Community Forum
    • Tutorials
Download
ScyllaDB Docs Scylla C/C++ Driver Features Basics Schema Metadata

Schema Metadata¶

The driver provides access to keyspace and table metadata. This schema metadata is monitored by the control connection and automatically kept up-to-date.

void get_schema_metadata(CassSession* session) {
  /* Get snapshot of the schema */
  const CassSchemaMeta* schema_meta = cass_session_get_schema_meta(session);

  /* Get information about the "keyspace1" schema */
  const CassKeyspaceMeta* keyspace1_meta
    = cass_schema_meta_keyspace_by_name(schema_meta, "keyspace1");

  if (keyspace1_meta == NULL) {
    /* Handle error */
  }

  /* Get the key-value filed for "strategy_class" */
  const CassValue* strategy_class_value
    = cass_keyspace_meta_field_by_name(keyspace1_meta, "strategy_class");

  if (strategy_class_value == NULL) {
    /* Handle error */
  }

  /* Fields values use the existing cass_value*() API */
  const char* strategy_class;
  size_t strategy_class_length;
  cass_value_get_string(strategy_class_value,
                        &strategy_class,
                        &strategy_class_length);

  /* Do something with strategy_class */

  /* All values derived from the schema are cleaned up */
  cass_schema_meta_free(schema_meta);
}

The snapshot obtained by cass_session_get_schema_meta() will not see schema changes that happened after the call. A new snapshot needs to be obtained to see subsequent updates to the schema.

Enabling/Disabling Schema Metadata¶

Retrieving and updating schema metadata can be enabled or disabled. It is enabled by default. However, some application might wish to reduce this overhead. This can be useful to improve the startup performance of the short-lived sessions or an environment where up-to-date schema metadata is unnecessary.

CassCluster* cluster = cass_cluster_new();

/* Disable schema metdata */
cass_cluster_set_use_schema(cluster, cass_false);

cass_cluster_free(cluster);

Was this page helpful?

PREVIOUS
Prepared Statements
NEXT
Tuples
  • Create an issue
  • Edit this page

On this page

  • Schema Metadata
    • Enabling/Disabling Schema Metadata
Scylla C/C++ Driver
  • master
    • master
  • C/C++ Driver for ScyllaDB
  • API Documentation
    • CassAggregateMeta
    • CassAuthenticator
    • CassAuthenticatorCallbacks
    • CassBatch
    • CassCluster
    • CassCollection
    • CassColumnMeta
    • CassCustomPayload
    • CassDataType
    • CassErrorResult
    • CassExecProfile
    • CassFunctionMeta
    • CassFuture
    • CassIndexMeta
    • CassInet
    • CassIterator
    • CassKeyspaceMeta
    • CassLogMessage
    • CassMaterializedViewMeta
    • CassMetrics
    • CassNode
    • CassPrepared
    • CassResult
    • CassRetryPolicy
    • CassRow
    • CassSchemaMeta
    • CassSession
    • CassSpeculativeExecutionMetrics
    • CassSsl
    • CassStatement
    • CassTableMeta
    • CassTimestampGen
    • CassTuple
    • CassUserType
    • CassUuid
    • CassUuidGen
    • CassValue
    • CassVersion
    • DseDateRange
    • DseDateRangeBound
    • DseLineString
    • DseLineStringIterator
    • DsePolygon
    • DsePolygonIterator
  • Features
    • Basics
      • Batches
      • Binding Parameters
      • Client-side timestamps
      • Consistency
      • Data Types
      • The date and time Types
      • Futures
      • Handling Results
      • Keyspaces
      • Prepared Statements
      • Schema Metadata
      • Tuples
      • User-Defined Types (UDTs)
      • UUIDs
    • Building
    • Client Configuration
    • Cloud
    • Configuration
      • Retry policies
    • Execution Profiles
    • FAQ
    • Installation
    • Logging
    • Metrics
    • Scylla Specific Features
    • Security
      • SSL
    • Testing
      • Cassandra Cluster Manager (CCM)
    • Tracing
  • DSE Features
    • Authentication
    • Geospatial types
Docs Tutorials University Contact Us About Us
© 2025, ScyllaDB. All rights reserved. | Terms of Service | Privacy Policy | ScyllaDB, and ScyllaDB Cloud, are registered trademarks of ScyllaDB, Inc.
Last updated on 28 April 2025.
Powered by Sphinx 7.4.7 & ScyllaDB Theme 1.8.6