activerecord-spanner-adapter - Module ActiveRecord::ConnectionAdapters::Spanner::DatabaseStatements (v2.0.0)

Reference documentation and code samples for the activerecord-spanner-adapter module ActiveRecord::ConnectionAdapters::Spanner::DatabaseStatements.

Methods

#_has_pk_binding

def _has_pk_binding(pk, binds)

#append_request_tag_from_query_logs

def append_request_tag_from_query_logs(sql, binds)

#append_request_tag_from_query_logs_with_format

def append_request_tag_from_query_logs_with_format(sql, binds, prefix)

#begin_db_transaction

def begin_db_transaction()

#begin_isolated_db_transaction

def begin_isolated_db_transaction(isolation)

Begins a transaction on the database with the specified isolation level. Cloud Spanner only supports isolation level :serializable, but also defines three additional 'isolation levels' that can be used to start specific types of Spanner transactions:

  • :read_only: Starts a read-only snapshot transaction using a strong timestamp bound.
  • :buffered_mutations: Starts a read/write transaction that will use mutations instead of DML for single-row inserts/updates/deletes. Mutations are buffered locally until the transaction is committed, and any changes during a transaction cannot be read by the application.
  • :pdml: Starts a Partitioned DML transaction. Executing multiple DML statements in one PDML transaction block is NOT supported A PDML transaction is not guaranteed to be atomic. See https://cloud.google.com/spanner/docs/dml-partitioned for more information.

In addition to the above, a Hash containing read-only snapshot options may be used to start a specific read-only snapshot:

  • { timestamp: Time } Starts a read-only snapshot at the given timestamp.
  • { staleness: Integer } Starts a read-only snapshot with the given staleness in seconds.
  • { strong:

#commit_db_transaction

def commit_db_transaction()

#delete

def delete(arel, name = nil, binds = [])
Alias Of: #update

#exec_delete

def exec_delete(sql, name = "SQL", binds = [])
Alias Of: #exec_update
Raises
  • (ActiveRecord::StatementInvalid)

#exec_mutation

def exec_mutation(mutation)

#exec_query

def exec_query(sql, name = "SQL", binds = [], prepare: false)

rubocop:disable Lint/UnusedMethodArgument

#exec_update

def exec_update(sql, name = "SQL", binds = [])
Aliases
Raises
  • (ActiveRecord::StatementInvalid)

#execute

def execute(sql, name = nil, binds = [])

DDL, DML and DQL Statements

#execute_ddl

def execute_ddl(statements)

#execute_query_or_dml

def execute_query_or_dml(statement_type, sql, name, binds)

#internal_exec_query

def internal_exec_query(sql, name = "SQL", binds = [], prepare: false, async: false, allow_retry: false)

#internal_execute

def internal_execute(sql, name = "SQL", binds = [], prepare: false, async: false, allow_retry: false)

#query

def query(sql, name = nil)

ActiveRecord.gem_version < VERSION_7_1_0

#rollback_db_transaction

def rollback_db_transaction()

#sql_for_insert

def sql_for_insert(sql, pk, binds)

#transaction

def transaction(requires_new: nil, isolation: nil, joinable: true)

Transaction

#transaction_isolation_levels

def transaction_isolation_levels()

#truncate

def truncate(table_name, name = nil)

#update

def update(arel, name = nil, binds = [])
Aliases

#write_query?

def write_query?(sql) -> Boolean
Returns
  • (Boolean)

Constants

VERSION_7_1_0

value: Gem::Version.create "7.1.0"

RequestOptions

value: Google::Cloud::Spanner::V1::RequestOptions

COMMENT_REGEX

value: ActiveRecord::ConnectionAdapters::AbstractAdapter::COMMENT_REGEX