pyre.db.SQL

Module Contents

class pyre.db.SQL.SQL(**kwds)

Bases: pyre.weaver.SQL.SQL

Generate SQL statements

INDENTER
select(self, query)

Generate the SELECT statement described by {query}

transaction(self)

Generate the SQL statement that initiates a transaction block

commit(self)

Generate the SQL statement that closes a transaction block

rollback(self)

Generate the SQL statement that rolls back a transaction

createDatabase(self, name)

Generate the SQL statement to create the database {name}

dropDatabase(self, name)

Generate the SQL statement to drop the database {name}

createTable(self, table)

Generate the SQL statement to create a database table given its description

The {table} specification is expected to be a {Table} subclass, with the necessary column information provided by the decorated field descriptors

dropTable(self, table)

Build the statement to drop the given {table}

insertRecords(self, *records)

Insert {records}, an iterable of table records, into their corresponding table

deleteRecords(self, table, condition)

Remove all {table} records that match {condition}

If condition is {None}, this routine will remove all records from the given {table}

updateRecords(self, template, condition)

Update all table rows that match {condition} using information from {template}, a prototype row of a table. The update operation sets the fields in these rows to their corresponding values in {template}; fields set to {None} in {template} are not affected.

_collationRenderer(self, order, context=None, **kwds)

Render the collation order specification

_fieldReferenceRenderer(self, node, context=None, **kwds)

Render {node} as reference to a field

_primitiveSQLExpressionRenderer(self, node, context=None, **kwds)

Render {node} as a unary postfix operator

_fieldDeclaration(self, field, comma)

Build the declaration lines for a given table field

_referenceDeclaration(self, foreign, comma)

Build a declaration for a foreign key