moved everything into /trunk/ to create the standard svn layout, for use with tools that require this (eg. git-svn). IMPORTANT: do NOT do an `svn up`. instead, re-use your working copy's existing files with `svn switch` (http://svnbook.red-bean.com/en/1.6/svn.ref.svn.c.switch.html).
lib/sql_gen.py: Join: added custom_cond param that can be used to add to the JOIN condition
lib/sql_gen.py: ColValueCond: support conds that are just plain SQL (without separate left and right sides) using special custom_cond flag value
lib/sql_gen.py: added table2regclass_text()
lib/sql_gen.py: added col2col_ref() for interfacing with for SQL functions that take a util.col_ref
lib/sql_gen.py: import OrderedDict from collections instead of ordereddict for Mac 10.8 Mountain Lion upgrade
sql_gen.py: Join: Added support for mapping values which are lists, for use in USING joins
sql_gen.py: Cast: Support casts to unknown by casting to text first
sql_gen.py: Added get_value()
sql_gen.py: NotCond: Treat a condition that evaluates to NULL as false instead, so that the boolean effect of the condition is completely inverted
sql_gen.py: null_as_str: Use new null instead of hardcoding 'NULL'
sql_gen.py: Added null
sql_gen.py: simplify_expr(): Don't require () around NULL IS NULL and NULL IS NOT NULL because extra parentheses are not provided in index conditions, only in check constraint conditions
sql_gen.py: If no cols had srcs, return [] instead of the [()] that itertools.product() would have returned
sql_gen.py: concat(): Allow multiple "column" suffixes with "." when matching the existing suffix
sql_gen.py: Table: Added order_by attr to cache the results of table_order_by()
sql_gen.py: map_expr(): Don't replace an unquoted name when followed by ",", as it would be in an into table name for a function with multiple arguments (e.g. family in "_join_words(1=Field family, 2=Field name)")
sql_gen.py: null_sentinels: Added entry for date
sql_gen.py: map_expr(): Fixed bug where names were being replaced when they were inside another name. This occurred with combined names created by sql_io.into_table_name().
sql_gen.py: Added canon_type()
sql_gen.py: simplify_parens(): Removed extra simplify_parens() at end because it is done in the final iteration that performs no other replacements, so it is not necessary to also do it explicitly
sql_gen.py: not_false_re, not_true_re: Appended \b to ensure that true/false is only matched as a single word
sql_gen.py: simplify_expr(): Also simplify "NOT false" to true
sql_gen.py: simplify_expr(): Also simplify "NOT true" to false
Moved expression transforming functions from sql.py to sql_gen.py because they do not manipulate an actual database and merely generate SQL
sql_gen.py: is_text_col(): Use new is_text_type()
sql_gen.py: Added is_text_type()
sql_gen.py: ensure_not_null(): Documented that NULL has no type, hence the NoUnderlyingTableException being re-raised
sql_gen.py: ensure_not_null(): Just store the column type in col_type, instead of storing typed_col and using typed_col.type, now that other info in typed_col is no longer needed
sql_gen.py: ensure_not_null(): Use is_nullable() instead of determining nullability itself, for clarity
sql_gen.py: is_nullable(): Fixed bug where non-columns could not be sent to db.col_info()
sql_gen.py: ensure_not_null(): Always remove_col_rename() the column to ensure that it is acceptable by helper functions like is_nullable()
sql_gen.py: null_sentinels: Added 'unknown' for taxonrank
sql_gen.py: Added is_nullable()
sql_gen.py: EnsureNotNull: Support ArrayType types
sql_gen.py: Added ArrayType
sql_gen.py: ensure_not_null(): If type_ is set, cast the column to it if needed
sql_gen.py: is_text_col(): Also consider character varying to be a text type
sql_gen.py: Added is_text_col()
sql_gen.py: NoUnderlyingTableException: Take a (required) parameter for the item that had no underlying table, and provide this wherever a NoUnderlyingTableException is created
Removed trailing whitespace on non-empty lines
Use strings.ustr() or strings.urepr() everywhere that columns are stringified, in order to support column names with non-ASCII characters (such as in the Madidi data)
sql_gen.py: merge_not_null(): For clarity, use to_text() to represent NULL as the string 'NULL' instead of as the null sentinel for the column's type
sql_gen.py: Added to_text() and helper value null_as_str
sql_gen.py: ColDict: Documented that anything that isn't a column is wrapped in a NamedCol
sql_gen.py: ColDict.__setitem__(): Fixed bug where None value should not be replaced with column default value if column has no underlying table
sql_gen.py: plpythonu_error_handler: Fixed bug where PL/Python exceptions could not be filtered by strings after the first line, because only the "message" portion of the exception is available in SQLERRM
sql_gen.py: plpythonu_error_handler: Always raise PL/Python exceptions as data_exception so they go in the errors table, instead of aborting the iteration
sql_gen.py: plpythonu_error_handler: Fixed bug where not all PL/Python exceptions start with "PL/Python: " (e.g. on PostgreSQL 9.1 on vegbiendev), so the PL/Python prefix must be optional. Refactored to put IF clause for non-PL/Python exception at end for a more logical ordering of the conditions.
sql_gen.py: plpythonu_error_handler: Added section comment before handler block, so that it's clear in the (very long) wrapper function definition what the block is doing
sql_gen.py: plpythonu_error_handler: Translate specific Python exception types to PostgreSQL error codes (ValueError -> data_exception) instead of assuming everything is a data_exception. When removing the PL/Python prefix, preserve the Python exception class in a DETAIL message. Support non-PL/Python internal_errors by re-raising them.
sql_gen.py: Added reraise_exc
sql_gen.py: Exceptions: Added suppress_exc and use it in ExcHandler.to_str()
sql_gen.py: Cast: Support types which are Code objects
sql_gen.py: Added merge_not_null()
sql_gen.py: Added try_mk_not_null()
sql_gen.py: Renamed ArrayJoin to ArrayMerge to avoid confusion with Join (a SQL construct)
sql_gen.py: RowExcIgnore.to_str(): Compare self.row_var to global const row_var using == to allow caller to provide a copy of row_var with the underlying table set appropriately
sql_gen.py: underlying_table(): Support derived tables and row vars by obtaining the underlying table from the srcs
sql_gen.py: RowExcIgnore: If a custom row_var is used, require it to already be defined. This also allows sql_io.ExcToErrorsTable to place the column var definition in the outer DECLARE, eliminating the extra DECLARE block.
sql_gen.py: RowExcIgnore: Created global constant for default row_var for callers to use
sql_gen.py: RowExcIgnore.to_str(): Moved SQL comment explaining the use of an EXCEPTION block for each individual row to Python code to avoid cluttering the logged SQL code
sql_gen.py: Added ArrayJoin
sql_gen.py: Added Array and to_Array()
sql_gen.py: Added List and inherit from it in Tuple
sql_gen.py: Renamed Tuple to Row and List to Tuple to more accurately reflect the datatype generated by each class (a Tuple being merely a grouping of values)
sql_gen.py: Moved Composite types to Literal values section as a subsection, since Composite types was really about just the input syntaxes for these types
sql_gen.py: Replaced srcs_str() with cross_join_srcs() which more correctly combines the srcs of each column using a Cartesian product. Eventually, the entire tree of srcs will need to be preserved instead of flattened in order to properly attribute errors to a specific column or set of columns.
sql_gen.py: srcs_str(): Fixed bug where needed to filter out columns with no srcs so that there aren't empty elements in the ","-separated list
sql_gen.py: Added has_srcs()
sql_gen.py: Added NestedExcHandler
sql_gen.py: Added srcs_str()
sql_gen.py: as_Col(): Support non-Code, non-string inputs by making them Literals
sql_gen.py: Added is_col() and use it in is_table_col()
sql_gen.py: Moved repr() from ExcHandler to BaseExcHandler
sql_gen.py: Added BaseExcHandler and inherit from it in ExcHandlers
sql_gen.py: Added data_exception_handler
sql_gen.py: Added ExcToWarning
sql_gen.py: Added ReturnQuery
sql_gen.py: with_table(): Only set the table if the passed-in value is a Col or FunctionCall
sql_gen.py: Added Tuple
sql_gen.py: Added List and use it in Values.to_str()
sql_gen.py: Added SetOf
sql_gen.py: FunctionDef: Support return_types which are Code objects
sql_gen.py: Added ColType
sql_gen.py: Added RowType
sql_gen.py: RowExcIgnore: Accept row types which are Code objects
sql_gen.py: TypedCol: Accept types which are Code objects
sql_gen.py: FunctionDef: Renamed args to params
sql_gen.py: FunctionDef: Accept parameters as FunctionParam objects instead of strings
sql_gen.py: Added FunctionParam
sql_gen.py: Added plpythonu_error_handler
Autogenerated SQL code: Use new strings.indent() where needed
sql_gen.py: ExcHandler: Removed extra newline after handler
sql_gen.py: FunctionDef: Added support for parameters
sql_gen.py: ExcHandler.to_str(): Removed extra newline after body
sql_gen.py: ExcHandler: Added repr() since it's not a Code object
sql_gen.py: FunctionDef: Support custom function modifiers
sql_gen.py: RowExcIgnore: Changed exc param to exc_handler to allow user to specify handler code for the exception
sql_gen.py: Added ExcHandler, unique_violation_handler