A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://cloud.google.com/python/docs/reference/spanner/latest/session-api below:

Python client library | Google Cloud

Session API

Wrapper for Cloud Spanner Session objects.

google.cloud.spanner_v1.session.DEFAULT_RETRY_TIMEOUT_SECS( = 3 )

Default timeout used by Session.run_in_transaction().

class google.cloud.spanner_v1.session.Session(database, labels=None, database_role=None)

Bases: object

Representation of a Cloud Spanner Session.

We can use a Session to:

batch()

Factory to create a batch for this session.

create()

Create this session, bound to its database.

See https://cloud.google.com/spanner/reference/rpc/google.spanner.v1#google.spanner.v1.Spanner.CreateSession

property database_role()

User-assigned database-role for the session.

delete()

Delete this session.

See https://cloud.google.com/spanner/reference/rpc/google.spanner.v1#google.spanner.v1.Spanner.GetSession

execute_sql(sql, params=None, param_types=None, query_mode=None, query_options=None, request_options=None, retry=<_MethodDefault._DEFAULT_VALUE:

Perform an ExecuteStreamingSql API request.

exists()

Test for the existence of this session.

See https://cloud.google.com/spanner/reference/rpc/google.spanner.v1#google.spanner.v1.Spanner.GetSession

property labels()

User-assigned labels for the session.

property name()

Session name used in requests.

NOTE: This property will not change if session_id does not, but the return value is not cached.

The session name is of the form

"projects/../instances/../databases/../sessions/{session_id}"

ping()

Ping the session to keep it alive by executing “SELECT 1”.

read(table, columns, keyset, index='', limit=0)

Perform a StreamingRead API request for rows in a table.

run_in_transaction(func, *args, **kw)

Perform a unit of work in a transaction, retrying on abort.

property session_id()

Read-only ID, set by the back-end during create().

snapshot(**kw)

Create a snapshot to perform a set of reads with shared staleness.

See https://cloud.google.com/spanner/reference/rpc/google.spanner.v1#google.spanner.v1.TransactionOptions.ReadOnly

transaction()

Create a transaction to perform a set of reads with shared staleness.

Session Pools API

Pools managing shared Session objects.

class google.cloud.spanner_v1.pool.AbstractSessionPool(labels=None, database_role=None)

Bases: object

Specifies required API for concrete session pool implementations.

bind(database)

Associate the pool with a database.

Concrete implementations of this method may pre-fill the pool using the database.

clear()

Delete all sessions in the pool.

Concrete implementations of this method are allowed to raise an error to signal that the pool is full, or to block until it is not full.

property database_role()

User-assigned database_role for sessions created by the pool.

get()

Check a session out from the pool.

Concrete implementations of this method are allowed to raise an error to signal that the pool is exhausted, or to block until a session is available.

property labels()

User-assigned labels for sessions created by the pool.

put(session)

Return a session to the pool.

Concrete implementations of this method are allowed to raise an error to signal that the pool is full, or to block until it is not full.

session(**kwargs)

Check out a session from the pool.

class google.cloud.spanner_v1.pool.BurstyPool(target_size=10, labels=None, database_role=None)

Bases: google.cloud.spanner_v1.pool.AbstractSessionPool

Concrete session pool implementation:

bind(database)

Associate the pool with a database.

clear()

Delete all sessions in the pool.

get()

Check a session out from the pool.

put(session)

Return a session to the pool.

Never blocks: if the pool is full, the returned session is discarded.

class google.cloud.spanner_v1.pool.FixedSizePool(size=10, default_timeout=10, labels=None, database_role=None)

Bases: google.cloud.spanner_v1.pool.AbstractSessionPool

Concrete session pool implementation:

bind(database)

Associate the pool with a database.

clear()

Delete all sessions in the pool.

get(timeout=None)

Check a session out from the pool.

put(session)

Return a session to the pool.

Never blocks: if the pool is full, raises.

class google.cloud.spanner_v1.pool.PingingPool(size=10, default_timeout=10, ping_interval=3000, labels=None, database_role=None)

Bases: google.cloud.spanner_v1.pool.AbstractSessionPool

Concrete session pool implementation:

The application is responsible for calling ping() at appropriate times, e.g. from a background thread.

bind(database)

Associate the pool with a database.

clear()

Delete all sessions in the pool.

get(timeout=None)

Check a session out from the pool.

ping()

Refresh maybe-expired sessions in the pool.

This method is designed to be called from a background thread, or during the “idle” phase of an event loop.

put(session)

Return a session to the pool.

Never blocks: if the pool is full, raises.

class google.cloud.spanner_v1.pool.SessionCheckout(pool, **kwargs)

Bases: object

Context manager: hold session checked out from a pool.

class google.cloud.spanner_v1.pool.TransactionPingingPool(size=10, default_timeout=10, ping_interval=3000, labels=None, database_role=None)

Bases: google.cloud.spanner_v1.pool.PingingPool

Concrete session pool implementation:

Deprecated: TransactionPingingPool no longer begins a transaction for each of its sessions at startup. Hence the TransactionPingingPool is same as PingingPool and maybe removed in the future.

In addition to the features of PingingPool, this class creates and begins a transaction for each of its sessions at startup.

When a session is returned to the pool, if its transaction has been committed or rolled back, the pool creates a new transaction for the session and pushes the transaction onto a separate queue of “transactions to begin.” The application is responsible for flushing this queue as appropriate via the pool’s begin_pending_transactions() method.

This throws a deprecation warning on initialization.

begin_pending_transactions()

Begin all transactions for sessions added to the pool.

bind(database)

Associate the pool with a database.

put(session)

Return a session to the pool.

Never blocks: if the pool is full, raises.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4