Classes, methods and stuff.
Fetches rows from a Bigtable.
Retrieves rows pertaining to the given keys from the Table instance represented by big_table. Silly things may happen if other_silly_variable is not None.
big_table: An open Bigtable Table instance. keys: A sequence of strings representing the key of each table row to fetch. other_silly_variable: Another optional variable, that has a much
longer name than the other args, and which does nothing.
A dict mapping keys to the corresponding table row data fetched. Each row is represented as a tuple of strings. For example:
{'Serak': ('Rigel VII', 'Preparer'),
'Zim': ('Irk', 'Invader'),
'Lrrr': ('Omicron Persei 8', 'Emperor')}
If a key from the keys argument is missing from the dictionary, then that row was not found in the table.
Call a stored database procedure with the given name.
See momoko.Connection.callproc() for documentation about the parameters.
Close the connection pool.
Prepare and execute a database operation (query or command).
See momoko.Connection.execute() for documentation about the parameters.
Acquire connection from the pool.
You can then use this connection for subsequest queries. Just supply, for example, connection.execute instead of Pool.execute to momoko.Op.
Make sure to return connection to the pool by calling momoko.Pool.putconn(), otherwise the connection will remain forever-busy and you’ll starvate your pool quickly.
Parameters: | ping (boolean) – Whether to ping connection before returning it by executing momoko.Pool.ping(). |
---|
Context manager that automatically returns connection to the pool. You can use it instead of momoko.Pool.putconn():
connection = yield momoko.Op(self.db.getconn)
with self.db.manage(connection):
cursor = yield momoko.Op(connection.execute, "BEGIN")
...
Return a query string after arguments binding.
See momoko.Connection.mogrify() for documentation about the parameters.
Ping given connection object to make sure its alive (involves roundtrip to the database server).
See momoko.Connection.ping() for documentation about the details.
Retrun busy connection back to the pool.
Parameters: | connection (Connection) – Connection object previously returned by momoko.Pool.getconn(). |
---|
Register adapter and typecaster for dict-hstore conversions.
See momoko.Connection.register_hstore() for documentation about the parameters. This method has no globally parameter, because it already registers hstore to all the connections in the pool.
Run a sequence of SQL queries in a database transaction.
See momoko.Connection.transaction() for documentation about the parameters.
Initiate an asynchronous connect.
Parameters: |
|
---|
(Deprecated) Check if the connection is busy or not.
Call a stored database procedure with the given name.
The sequence of parameters must contain one entry for each argument that the procedure expects. The result of the call is returned as modified copy of the input sequence. Input parameters are left untouched, output and input/output parameters replaced with possibly new values.
The procedure may also provide a result set as output. This must then be made available through the standard fetch*() methods.
Parameters: |
|
---|
Remove the connection from the IO loop and close it.
Indicates whether the connection is closed or not.
Prepare and execute a database operation (query or command).
Parameters: |
|
---|
Return a query string after arguments binding.
The string returned is exactly the one that would be sent to the database running the execute() method or similar.
Parameters: |
|
---|
Make sure this connection is alive by executing SELECT 1 statement - i.e. roundtrip to the database.
NOTE: callback should always passed as keyword argument
Register adapter and typecaster for dict-hstore conversions.
More information on the hstore datatype can be found on the Psycopg2 documentation.
Parameters: |
|
---|
NOTE: callback should always passed as keyword argument
Run a sequence of SQL queries in a database transaction.
Parameters: |
|
---|
Run a single asynchronous operation.
Behaves like tornado.gen.Task, but raises an exception (one of Psycop2’s exceptions) when an error occurs related to Psycopg2 or PostgreSQL.
Return the argument passed to the result of a previous tornado.gen.Callback.
Behaves like tornado.gen.Wait, but raises an exception (one of Psycop2’s exceptions) when an error occurs related to Psycopg2 or PostgreSQL.
Return the results of multiple previous tornado.gen.Callback.
Behaves like tornado.gen.WaitAll, but raises an exception (one of Psycop2’s exceptions) when an error occurs related to Psycopg2 or PostgreSQL.