Package pysql :: Module pysqlfunctions
[hide private]
[frames] | no frames]

Module pysqlfunctions

source code

This module defines all high level functions of pysql


Authors:
Sébastien Renard (sebastien.renard@digitalfox.org), Sébastien Delcros (Sebastien.Delcros@gmail.com)

License: GNU GPL V3

Functions [hide private]
 
count(db, objectName)
Counts rows in a table
source code
 
compare(schemaA, schemaB)
Compares two Oracle schema and return the difference
source code
 
compareTables(schemaA, schemaB, tableNameA, tableNameB, dbList=None, data=False)
Compares structure or data of tableA from schemaA with tableB from schemaB This is a wrapper to either compareTableStructure or compareTableData.
source code
 
compareTableStructure(schemaA, schemaB, tableNameA, tableNameB, dbList)
Compares structure of tableA from schemaA with tableB from schemaB
source code
 
compareTableData(schemaA, schemaB, tableNameA, tableNameB, dbList)
Compares data of tableA from schemaA with tableB from schemaB
source code
 
ddl(db, objectName)
Gets the ddl of an object
source code
 
desc(db, objectName, completeMethod=None, printDetails=True, printStats=False, sort=False)
Describes an object
source code
 
edit(db, objectName, content="")
Edits properties of an Oracle object
source code
 
editor(content="")
Edits content with systemp editor
source code
 
explain(db, statement)
Computes and displays explain plan for statement
source code
 
lock(db)
Displays locks on objects
source code
 
sessions(db, all=False, search=None)
Returns top session, filter by "sort"
source code
 
sessionStat(db, sid, stat=None)
Displays detailed statistics for one session
source code
 
killSession(db, session, immediate=False)
Kills the given sessions
source code
 
showParameter(db, param="")
Shows the session parameters matching the pattern 'param'
source code
 
showServerParameter(db, param="")
Shows the server parameters matching the pattern 'param'
source code
 
searchObject(db, objectType, objectName, objectOwner)
Searches for Oracle objects by name with wildcard if needed
source code
Function Details [hide private]

count(db, objectName)

source code 

Counts rows in a table

Parameters:
  • objectName - table/view/M.View name
  • db - connection object
Returns:
number of rows (int)

compareTables(schemaA, schemaB, tableNameA, tableNameB, dbList=None, data=False)

source code 

Compares structure or data of tableA from schemaA with tableB from schemaB This is a wrapper to either compareTableStructure or compareTableData.

Parameters:
  • schemaA - connection string to the schema A
  • schemaB - connection string to the schema B
  • tableNameA - name of the table in schema A
  • tableNameB - name of the table in schema B
  • data - if true, compare data else, compare structure

compareTableStructure(schemaA, schemaB, tableNameA, tableNameB, dbList)

source code 

Compares structure of tableA from schemaA with tableB from schemaB

Parameters:
  • schemaA - connection string to the schema A
  • schemaB - connection string to the schema B

compareTableData(schemaA, schemaB, tableNameA, tableNameB, dbList)

source code 

Compares data of tableA from schemaA with tableB from schemaB

Parameters:
  • schemaA - connection string to the schema A
  • schemaB - connection string to the schema B

ddl(db, objectName)

source code 

Gets the ddl of an object

Returns:
ddl as string

desc(db, objectName, completeMethod=None, printDetails=True, printStats=False, sort=False)

source code 

Describes an object

Parameters:
  • objectName - object to be described
Returns:
header and resultset of definition as a tuple (header, definition) ==> This function should be split in two parts: one in pysqlOraObjects for object self description the other one here as a describe function that encapsulate pysqlOraObjects manipulation

edit(db, objectName, content="")

source code 

Edits properties of an Oracle object

Parameters:
  • objectName - name of the object to edit
Returns:
True if object has been found correctly updated. Else, return False

editor(content="")

source code 

Edits content with systemp editor

Parameters:
  • content (string) - initial data to edit. Default is empty string
Returns:
None is content does not change, else modified content

explain(db, statement)

source code 

Computes and displays explain plan for statement

Parameters:
  • statement - sql statement to be explained
Returns:
explain plan (list of string)

lock(db)

source code 

Displays locks on objects

Returns:
resultset in tabular format

sessions(db, all=False, search=None)

source code 

Returns top session, filter by "sort"

Parameters:
  • all (bool) - Show all sessions, not only active (top) session
  • search - search session program, name, ouser... that looks like the str given
Returns:
huge resultset in tabular format

sessionStat(db, sid, stat=None)

source code 

Displays detailed statistics for one session

Parameters:
  • stat - can be ios, locks, waitEvents, openCurors, details
Returns:
array of results

killSession(db, session, immediate=False)

source code 

Kills the given sessions

Parameters:
  • session (str) - 'session-id,session-serial'
  • immediate (bool) - sends the immediate option to kill
Returns:
None but raises an exception if session does not exist

showParameter(db, param="")

source code 

Shows the session parameters matching the pattern 'param'

Parameters:
  • param (str) - pattern to be matched
Returns:
resultset in tabular format

showServerParameter(db, param="")

source code 

Shows the server parameters matching the pattern 'param'

Parameters:
  • param (str) - pattern to be matched
Returns:
resultset in tabular format