Scylla Documentation Logo Documentation
  • Server
    • Scylla Open Source
    • Scylla Enterprise
    • Scylla Alternator
  • Cloud
    • Scylla Cloud
    • Scylla Cloud Docs
  • Tools
    • Scylla Manager
    • Scylla Monitoring Stack
    • Scylla Operator
  • Drivers
    • CQL Drivers
    • DynamoDB Drivers
Download
Menu
Scylla C/C++ Driver Documentation 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);
PREVIOUS
Prepared Statements
NEXT
Tuples
  • master
    • master
  • C/C++ Driver for ScyllaDB
  • API Documentation
    • CassAggregateMeta
    • CassAuthenticator
    • CassBatch
    • CassCluster
    • CassCollection
    • CassColumnMeta
    • CassCustomPayload
    • CassDataType
    • CassErrorResult
    • CassExecProfile
    • CassFunctionMeta
    • CassFuture
    • CassIndexMeta
    • CassInet
    • CassIterator
    • CassKeyspaceMeta
    • CassMaterializedViewMeta
    • CassMetrics
    • CassNode
    • CassPrepared
    • CassResult
    • CassRetryPolicy
    • CassRow
    • CassSchemaMeta
    • CassSession
    • 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
  • Create an issue
  • Edit this page

On this page

  • Schema Metadata
    • Enabling/Disabling Schema Metadata
Logo
Docs Contact Us About Us
Mail List Icon Slack Icon
© 2022, ScyllaDB. All rights reserved.
Last updated on 18 October 2022.
Powered by Sphinx 4.3.2 & ScyllaDB Theme 1.3.1