| |
- SQLQuery(Propertied)
-
- ListDatabases
- ListIndices
- ListTables
- TableStructure
class ListDatabases(SQLQuery) |
|
Queries PostgreSQL server for list of database-names
returns a simple list of string names |
|
- Method resolution order:
- ListDatabases
- SQLQuery
- Propertied
- object
Methods defined here:
- processResults(self, cursor, **namedarguments)
- Read database name list from cursor
Data and other attributes defined here:
- sql = 'SHOW DATABASES;'
Methods inherited from SQLQuery:
- __call__(self, cursor, **namedarguments)
- Execute with cursor
cursor -- the pytable.dbcursor object to be
used for executing the query. Note that the
query will attempt to automatically coerce a
dbdriver or dbconnection object to a cursor
using that driver/connection. A log warning
will be returned if passing a driver (which
is not recommended, as it will result in
significant setup overhead (connections are
expensive to create for a single execution)).
namedarguments -- will be substituted using
python string substitution into the template
query string in order to create the final
query string. For single-execution queries
(SQLQuery), the namedarguments also represent
the row from which query arguments will be
taken. For multiple-execution queries
(SQLMultiQuery), the namedargument "dataSet"
is used as the executemany argument.
The "do" method takes care of the actual execution
of the query after cursor-coercion and query
substitution.
The "processResults" method takes the cursor and
returns the final result-set for the query which
will be the value returned from this function.
By default, this is simply a pointer to the cursor
used to execute the query.
- __init__(self, sql=None, debug=None, **named)
- Initialise the SQLQuery
sql -- sql string or None to use class' sql value
debug -- if provided (not None), override class' debug flag
- do(self, cursor, query, **namedarguments)
- Do the actual processing of the query (execute)
cursor -- a dbcursor object
query -- a final SQL query string, must be fully
substituted so that decree will operate properly
with the given cursor.
namedarguments -- for the single-query version,
(SQLQuery, this version), used as the dictionary
source for named and pyformat query arguments.
These are the same arguments passed to the
__call__ method.
returns the result of the cursor's execute method,
which is currently ignored by the __call__ method.
- encodeQuery(self, query, cursor=None)
- Encode query for use by the given cursor
Data and other attributes inherited from SQLQuery:
- debug = 0
- name = ''
Methods inherited from Propertied:
- __str__(self)
- Get a friendly representation of the object
- clone(self, **newValues)
- Clone this object, with optional new property values
This method calls the __init__ method of your class with
the current property values of your class. Providing newValues
(a dictionary) overrides property settings with new values.
- getCloneProperties(self)
- Get properties dictionary (key:value) for use in cloning of the instance
By default you get getProperties()' values, with an
attempt made to use the property's name, then the property's
direct "__get__" method.
- toString(self, indentation='', alreadyDone=None, indentString=' ')
- Get a nicely formatted representation of this object
This version assumes that getProperties returns
the list of properties which should be presented,
it recursively calls it's children with greater
indents to get their representations.
indentation -- current string indentation level
alreadyDone -- set of object ids which are already finished
XXX Needs a far better API, likely a stand-alone class
without the automatic inheritance problems here :(
Class methods inherited from Propertied:
- getProperties(cls) from type
- Get the BasicProperty properties for a particular object's class
Data and other attributes inherited from Propertied:
- __dict__ = <dictproxy object at 0x01AFBF70>
- dictionary for instance variables (if defined)
- __weakref__ = <attribute '__weakref__' of 'Propertied' objects>
- list of weak references to the object (if defined)
|
class ListIndices(SQLQuery) |
|
Get index-data-records for a given table
Returns a mysql-specific table format... |
|
- Method resolution order:
- ListIndices
- SQLQuery
- Propertied
- object
Methods defined here:
- processResults(self, cursor, **named)
- returns results of the selection as an unadorned set
Data and other attributes defined here:
- sql = 'SHOW INDEX FROM %(tableName)s;'
Methods inherited from SQLQuery:
- __call__(self, cursor, **namedarguments)
- Execute with cursor
cursor -- the pytable.dbcursor object to be
used for executing the query. Note that the
query will attempt to automatically coerce a
dbdriver or dbconnection object to a cursor
using that driver/connection. A log warning
will be returned if passing a driver (which
is not recommended, as it will result in
significant setup overhead (connections are
expensive to create for a single execution)).
namedarguments -- will be substituted using
python string substitution into the template
query string in order to create the final
query string. For single-execution queries
(SQLQuery), the namedarguments also represent
the row from which query arguments will be
taken. For multiple-execution queries
(SQLMultiQuery), the namedargument "dataSet"
is used as the executemany argument.
The "do" method takes care of the actual execution
of the query after cursor-coercion and query
substitution.
The "processResults" method takes the cursor and
returns the final result-set for the query which
will be the value returned from this function.
By default, this is simply a pointer to the cursor
used to execute the query.
- __init__(self, sql=None, debug=None, **named)
- Initialise the SQLQuery
sql -- sql string or None to use class' sql value
debug -- if provided (not None), override class' debug flag
- do(self, cursor, query, **namedarguments)
- Do the actual processing of the query (execute)
cursor -- a dbcursor object
query -- a final SQL query string, must be fully
substituted so that decree will operate properly
with the given cursor.
namedarguments -- for the single-query version,
(SQLQuery, this version), used as the dictionary
source for named and pyformat query arguments.
These are the same arguments passed to the
__call__ method.
returns the result of the cursor's execute method,
which is currently ignored by the __call__ method.
- encodeQuery(self, query, cursor=None)
- Encode query for use by the given cursor
Data and other attributes inherited from SQLQuery:
- debug = 0
- name = ''
Methods inherited from Propertied:
- __str__(self)
- Get a friendly representation of the object
- clone(self, **newValues)
- Clone this object, with optional new property values
This method calls the __init__ method of your class with
the current property values of your class. Providing newValues
(a dictionary) overrides property settings with new values.
- getCloneProperties(self)
- Get properties dictionary (key:value) for use in cloning of the instance
By default you get getProperties()' values, with an
attempt made to use the property's name, then the property's
direct "__get__" method.
- toString(self, indentation='', alreadyDone=None, indentString=' ')
- Get a nicely formatted representation of this object
This version assumes that getProperties returns
the list of properties which should be presented,
it recursively calls it's children with greater
indents to get their representations.
indentation -- current string indentation level
alreadyDone -- set of object ids which are already finished
XXX Needs a far better API, likely a stand-alone class
without the automatic inheritance problems here :(
Class methods inherited from Propertied:
- getProperties(cls) from type
- Get the BasicProperty properties for a particular object's class
Data and other attributes inherited from Propertied:
- __dict__ = <dictproxy object at 0x01AFBF50>
- dictionary for instance variables (if defined)
- __weakref__ = <attribute '__weakref__' of 'Propertied' objects>
- list of weak references to the object (if defined)
|
class ListTables(SQLQuery) |
|
Queries connection/cursor for list of table-names
returns a simple list of string names |
|
- Method resolution order:
- ListTables
- SQLQuery
- Propertied
- object
Methods defined here:
- processResults(self, cursor, **namedarguments)
- Read table name list from cursor
Data and other attributes defined here:
- sql = 'SHOW TABLES;'
Methods inherited from SQLQuery:
- __call__(self, cursor, **namedarguments)
- Execute with cursor
cursor -- the pytable.dbcursor object to be
used for executing the query. Note that the
query will attempt to automatically coerce a
dbdriver or dbconnection object to a cursor
using that driver/connection. A log warning
will be returned if passing a driver (which
is not recommended, as it will result in
significant setup overhead (connections are
expensive to create for a single execution)).
namedarguments -- will be substituted using
python string substitution into the template
query string in order to create the final
query string. For single-execution queries
(SQLQuery), the namedarguments also represent
the row from which query arguments will be
taken. For multiple-execution queries
(SQLMultiQuery), the namedargument "dataSet"
is used as the executemany argument.
The "do" method takes care of the actual execution
of the query after cursor-coercion and query
substitution.
The "processResults" method takes the cursor and
returns the final result-set for the query which
will be the value returned from this function.
By default, this is simply a pointer to the cursor
used to execute the query.
- __init__(self, sql=None, debug=None, **named)
- Initialise the SQLQuery
sql -- sql string or None to use class' sql value
debug -- if provided (not None), override class' debug flag
- do(self, cursor, query, **namedarguments)
- Do the actual processing of the query (execute)
cursor -- a dbcursor object
query -- a final SQL query string, must be fully
substituted so that decree will operate properly
with the given cursor.
namedarguments -- for the single-query version,
(SQLQuery, this version), used as the dictionary
source for named and pyformat query arguments.
These are the same arguments passed to the
__call__ method.
returns the result of the cursor's execute method,
which is currently ignored by the __call__ method.
- encodeQuery(self, query, cursor=None)
- Encode query for use by the given cursor
Data and other attributes inherited from SQLQuery:
- debug = 0
- name = ''
Methods inherited from Propertied:
- __str__(self)
- Get a friendly representation of the object
- clone(self, **newValues)
- Clone this object, with optional new property values
This method calls the __init__ method of your class with
the current property values of your class. Providing newValues
(a dictionary) overrides property settings with new values.
- getCloneProperties(self)
- Get properties dictionary (key:value) for use in cloning of the instance
By default you get getProperties()' values, with an
attempt made to use the property's name, then the property's
direct "__get__" method.
- toString(self, indentation='', alreadyDone=None, indentString=' ')
- Get a nicely formatted representation of this object
This version assumes that getProperties returns
the list of properties which should be presented,
it recursively calls it's children with greater
indents to get their representations.
indentation -- current string indentation level
alreadyDone -- set of object ids which are already finished
XXX Needs a far better API, likely a stand-alone class
without the automatic inheritance problems here :(
Class methods inherited from Propertied:
- getProperties(cls) from type
- Get the BasicProperty properties for a particular object's class
Data and other attributes inherited from Propertied:
- __dict__ = <dictproxy object at 0x01AFBFB0>
- dictionary for instance variables (if defined)
- __weakref__ = <attribute '__weakref__' of 'Propertied' objects>
- list of weak references to the object (if defined)
|
class TableStructure(SQLQuery) |
|
Reverse-engineer table structure/schema from database
This is a very heavy mechanism for design-time use
which attempts to describe a table in the database
using the dbschema objects which would normally
be used to proactively define how we interact with
the table.
There are actually three different queries being
done during the TableStructure query. The first
is the base query, which simply retrieves the
DB API 2.0 column descriptions. These provide
much of the basic information required.
The second stage retrieves the foreign-key
constraints for the table. Eventually this should
also return general constraints (check restraints)
to allow for automatically setting up constraint
numeric and/or string data types.
The third stage retrieves information about indices
on the table. This includes primary, unique and
multi-field indices, but not check indices. |
|
- Method resolution order:
- TableStructure
- SQLQuery
- Propertied
- object
Methods defined here:
- processResults(self, cursor, tableName, **namedarguments)
- Build Table and Field descriptors through introspection
Data and other attributes defined here:
- sql = '\n\tSELECT *\n\tFROM %(tableName)s\n\tLIMIT 1;'
Methods inherited from SQLQuery:
- __call__(self, cursor, **namedarguments)
- Execute with cursor
cursor -- the pytable.dbcursor object to be
used for executing the query. Note that the
query will attempt to automatically coerce a
dbdriver or dbconnection object to a cursor
using that driver/connection. A log warning
will be returned if passing a driver (which
is not recommended, as it will result in
significant setup overhead (connections are
expensive to create for a single execution)).
namedarguments -- will be substituted using
python string substitution into the template
query string in order to create the final
query string. For single-execution queries
(SQLQuery), the namedarguments also represent
the row from which query arguments will be
taken. For multiple-execution queries
(SQLMultiQuery), the namedargument "dataSet"
is used as the executemany argument.
The "do" method takes care of the actual execution
of the query after cursor-coercion and query
substitution.
The "processResults" method takes the cursor and
returns the final result-set for the query which
will be the value returned from this function.
By default, this is simply a pointer to the cursor
used to execute the query.
- __init__(self, sql=None, debug=None, **named)
- Initialise the SQLQuery
sql -- sql string or None to use class' sql value
debug -- if provided (not None), override class' debug flag
- do(self, cursor, query, **namedarguments)
- Do the actual processing of the query (execute)
cursor -- a dbcursor object
query -- a final SQL query string, must be fully
substituted so that decree will operate properly
with the given cursor.
namedarguments -- for the single-query version,
(SQLQuery, this version), used as the dictionary
source for named and pyformat query arguments.
These are the same arguments passed to the
__call__ method.
returns the result of the cursor's execute method,
which is currently ignored by the __call__ method.
- encodeQuery(self, query, cursor=None)
- Encode query for use by the given cursor
Data and other attributes inherited from SQLQuery:
- debug = 0
- name = ''
Methods inherited from Propertied:
- __str__(self)
- Get a friendly representation of the object
- clone(self, **newValues)
- Clone this object, with optional new property values
This method calls the __init__ method of your class with
the current property values of your class. Providing newValues
(a dictionary) overrides property settings with new values.
- getCloneProperties(self)
- Get properties dictionary (key:value) for use in cloning of the instance
By default you get getProperties()' values, with an
attempt made to use the property's name, then the property's
direct "__get__" method.
- toString(self, indentation='', alreadyDone=None, indentString=' ')
- Get a nicely formatted representation of this object
This version assumes that getProperties returns
the list of properties which should be presented,
it recursively calls it's children with greater
indents to get their representations.
indentation -- current string indentation level
alreadyDone -- set of object ids which are already finished
XXX Needs a far better API, likely a stand-alone class
without the automatic inheritance problems here :(
Class methods inherited from Propertied:
- getProperties(cls) from type
- Get the BasicProperty properties for a particular object's class
Data and other attributes inherited from Propertied:
- __dict__ = <dictproxy object at 0x01AFBFD0>
- dictionary for instance variables (if defined)
- __weakref__ = <attribute '__weakref__' of 'Propertied' objects>
- list of weak references to the object (if defined)
| |