baseplate.context.cassandra

Configuration Parsing

baseplate.context.cassandra.cluster_from_config(app_config, prefix=u'cassandra.', **kwargs)

Make a Cluster from a configuration dictionary.

The keys useful to cluster_from_config() should be prefixed, e.g. cassandra.contact_points etc. The prefix argument specifies the prefix used to filter keys. Each key is mapped to a corresponding keyword argument on the Cluster constructor. Any keyword arguments given to this function will be passed through to the Cluster constructor. Keyword arguments take precedence over the configuration file.

Supported keys:

  • contact_points (required): comma delimited list of contact points to try connecting for cluster discovery
  • port: The server-side port to open connections to.

Classes

class baseplate.context.cassandra.CassandraContextFactory(session)

Cassandra session context factory.

This factory will attach a proxy object which acts like a cassandra.cluster.Session to an attribute on the context object. The execute, execute_async or prepare methods will automatically record diagnostic information.

Parameters:session (cassandra.cluster.Session) – A configured session object.
class baseplate.context.cassandra.CQLMapperContextFactory(session)

CQLMapper ORM connection context factory

This factory will attach a new CQLMapper cqlmapper.connection.Connection to an attribute on the context object. This Connection object will use the same proxy object that CassandraContextFactory attaches to a context to run queries so the execute command will automatically record diagnostic information.

Parameters:session (cassandra.cluster.Session) – A configured session object.