Part of twistar.dbconfig.base View In Hierarchy
Known subclasses: twistar.dbconfig.mysql.MySQLDBConfig, twistar.dbconfig.postgres.PostgreSQLDBConfig, twistar.dbconfig.pyodbc.PyODBCDBConfig, twistar.dbconfig.sqlite.SQLiteDBConfig
Line # | Kind | Name | Docs |
---|---|---|---|
0 | Class Variable | LOG | If True, then all queries are logged using
twisted.python.log.msg . |
0 | Class Variable | includeBlankInInsert | If True, then insert/update queries will include setting object properties that have not be set to null in their respective columns. |
24 | Method | logEncode | Encode the given string if necessary for printing to logs. |
33 | Method | log | Log the query and any args or kwargs using
twisted.python.log.msg if InteractionBase.LOG is
True. |
47 | Method | executeOperation | Simply makes same
twisted.enterprise.dbapi.ConnectionPool.runOperation call, but
with call to log
function. |
56 | Method | execute | Simply makes same
twisted.enterprise.dbapi.ConnectionPool.runQuery call, but
with call to log
function. |
65 | Method | executeTxn | Execute given query within the given transaction. Also, makes call to
log
function. |
74 | Method | select | Select rows from a table. |
146 | Method | insertArgsToString | Convert {'name': value} to an insert "values"
string like "(%s,%s,%s)" . |
153 | Method | insert | Insert a row into the given table. |
179 | Method | escapeColNames | Escape column names for insertion into SQL statement. |
190 | Method | insertMany | Insert many values into a table. |
210 | Method | getLastInsertID | Using the given txn, get the id of the last inserted row. |
222 | Method | delete | Delete from the given tablename. |
239 | Method | update | Update a row into the given table. |
268 | Method | valuesToHash | Given a row from a database query (values), create a hash using keys from the table schema and values from the given values; |
290 | Method | getSchema | Get the schema (in the form of a list of column names) for a given tablename. Use the given transaction if specified. |
304 | Method | insertObj | Insert the given object into its table. |
323 | Method | updateObj | Update the given object's row in the object's table. |
340 | Method | refreshObj | Update the given object based on the information in the object's table. |
354 | Method | whereToString | Convert a conditional to the form needed for a query using the DBAPI.
For instance, for most DB's question marks in the query string have to be
converted to %s . This will vary by database. |
370 | Method | updateArgsToString | Convert dictionary of arguments to form needed for DB update query. This method will vary by database driver. |
385 | Method | count | Get the number of rows in the given table (optionally, that meet the given where criteria). |
126 | Method | _doselect | Private callback for actual select query call. |
twisted.python.log.msg
if InteractionBase.LOG
is
True.twisted.enterprise.dbapi.ConnectionPool.runOperation
call, but
with call to log
function.twisted.enterprise.dbapi.ConnectionPool.runQuery
call, but
with call to log
function.log
function.Parameters | tablename | The tablename to select rows from. |
id | If given, only the row with the given id will be returned (or
None if not found). | |
where | Conditional of the same form as the where parameter in DBObject.find . | |
group | String describing how to group results. | |
limit | Integer limit on the number of results. If this value is 1, then the
result will be a single dictionary. Otherwise, if id is not
specified, an array will be returned. This can also be a tuple, where the
first value is the integer limit and the second value is an integer offset.
In the case that an offset is specified, an array will always be returned. | |
orderby | String describing how to order the results. | |
select | Columns to select. Default is * . | |
Returns | If limit is 1 or id is set, then the result is one dictionary
or None if not found. Otherwise, an array of dictionaries are returned. |
{'name': value}
to an insert "values"
string like "(%s,%s,%s)"
.Parameters | tablename | Table to insert a row into. |
vals | Values to insert. Should be a dictionary in the form of {'name':
value, 'othername': value} . | |
txn | If txn is given it will be used for the query, otherwise a typical runQuery will be used | |
Returns | A Deferred that calls a callback with the id of new row. |
Parameters | colnames | A List of string column names. |
Returns | A List of string escaped column names. |
Parameters | tablename | Table to insert a row into. |
vals | Values to insert. Should be a list of dictionaries in the form of
{'name': value, 'othername': value} . | |
Returns | A Deferred . |
Returns | The integer id of the last inserted row. |
Parameters | where | Conditional of the same form as the where parameter in DBObject.find .
If given, the rows deleted will be restricted to ones matching this
conditional. |
Returns | A Deferred . |
Parameters | tablename | Table to insert a row into. |
args | Values to insert. Should be a dictionary in the form of {'name':
value, 'othername': value} . | |
where | Conditional of the same form as the where parameter in DBObject.find .
If given, the rows updated will be restricted to ones matching this
conditional. | |
txn | If txn is given it will be used for the query, otherwise a typical runQuery will be used | |
Returns | A Deferred |
Parameters | txn | The transaction to use for the schema update query. |
values | A row from a db (as a list ). | |
tablename | Name of the table to fetch the schema for. |
Returns | A Deferred that sends a callback the inserted object. |
Returns | A Deferred that sends a callback the updated object. |
Returns | A Deferred that sends a callback the updated object. |
%s
. This will vary by database.Parameters | where | Conditional of the same form as the where parameter in DBObject.find . |
Returns | A conditional in the same form as the where parameter in DBObject.find . |
Parameters | args | Values to insert. Should be a dictionary in the form of {'name':
value, 'othername': value} . |
Returns | A tuple of the form ('name = %s, othername = %s, ...',
argvalues) . |
Parameters | tablename | The tablename to count rows from. |
where | Conditional of the same form as the where parameter in DBObject.find . | |
Returns | A Deferred that returns the number of rows. |