Project

General

Profile

Statistics
| Revision:

# Date Author Comment
2844 06/14/2012 06:52 PM Aaron Marcuse-Kubitza

sql_gen.py: CompareCond.to_str(): Always wrap the left-side column if it's nullable. Wrap the right-side value if the left side was wrapped, rather than if both the left and right side are nullable. This causes coalesce() indexes to be used to look up NULL values using the value NULL gets coalesced to, rather than doing a sequential scan.

2843 06/14/2012 06:43 PM Aaron Marcuse-Kubitza

sql_gen.py: Run truncate() on all identifiers so that literal-string-based lookups for an identifier (such as in db.col_info()) don't use the untruncated value

2842 06/14/2012 06:40 PM Aaron Marcuse-Kubitza

sql_gen.py: Added truncate()

2841 06/14/2012 06:40 PM Aaron Marcuse-Kubitza

sql.py: put_table(): Resolving default value column: Fixed bug where default value of None was used as a key for mapping, even though this is an invalid Col name

2840 06/14/2012 05:30 PM Aaron Marcuse-Kubitza

sql_gen.py: ensure_not_null(): If input column cannot be ensured to be NULL, pass any raised exception through rather than suppressing it and leaving the column in a nullable state

2839 06/13/2012 11:11 PM Aaron Marcuse-Kubitza

schemas/functions.sql: _merge: Changed indexes to use `COALESCE` to match what sql_gen now does

2838 06/13/2012 11:08 PM Aaron Marcuse-Kubitza

schemas/functions.sql: _alt: Changed indexes to use `COALESCE` to match what sql_gen now does

2837 06/13/2012 10:59 PM Aaron Marcuse-Kubitza

sql_gen.py: CompareCond.to_str(): Handle nullable columns using ensure_not_null()

2836 06/13/2012 10:46 PM Aaron Marcuse-Kubitza

sql_gen.py: ensure_not_null(): Raise NoUnderlyingTableException if can't ensure not null for that reason

2835 06/13/2012 10:20 PM Aaron Marcuse-Kubitza

sql_gen.py: is_underlying_table(): Support non-Table inputs

2834 06/13/2012 10:15 PM Aaron Marcuse-Kubitza

sql_gen.py: NamedValues: Call set_cols_table() with the created table, not just the name, so that is_underlying_table() works properly

2833 06/13/2012 09:49 PM Aaron Marcuse-Kubitza

sql_gen.py: underlying_col(): If no underlying table, raise NoUnderlyingTableException

2832 06/13/2012 09:45 PM Aaron Marcuse-Kubitza

sql_gen.py: Added is_underlying_table()

2831 06/13/2012 09:34 PM Aaron Marcuse-Kubitza

sql_gen.py: ensure_not_null(): Call underlying_col() on the column to remove all renamings

2830 06/13/2012 09:33 PM Aaron Marcuse-Kubitza

sql_gen.py: Added underlying_col()

2829 06/13/2012 09:24 PM Aaron Marcuse-Kubitza

sql_gen.py: Join.to_str(): join(): Removed no longer needed `*_table = *_table.to_Table()`

2828 06/13/2012 09:22 PM Aaron Marcuse-Kubitza

sql_gen.py: Col: Support Table objects that are not just names, by calling `.to_Table()` on the table before stringifying it

2827 06/13/2012 09:22 PM Aaron Marcuse-Kubitza

sql_gen.py: Col: Support Table objects that are not just names, by calling `.to_Table()` on the table before stringifying it

2826 06/13/2012 08:59 PM Aaron Marcuse-Kubitza

sql_gen.py: ensure_not_null(): Added ignore_unknown_type param

2825 06/13/2012 08:55 PM Aaron Marcuse-Kubitza

sql_gen.py: CompareCond.to_str(): Put handling nullable columns as a separate step so it can be expanded

2824 06/13/2012 08:36 PM Aaron Marcuse-Kubitza

csv2db: Errors table: Removed no longer needed sql_gen.EnsureNotNull() because this is now added automatically

2823 06/13/2012 08:35 PM Aaron Marcuse-Kubitza

sql.py: add_index(): Handle nullable columns by using sql_gen.ensure_not_null() to automatically add a coalesce() wrapper where needed

2822 06/13/2012 08:33 PM Aaron Marcuse-Kubitza

sql_gen.py: Added ensure_not_null()

2821 06/13/2012 08:29 PM Aaron Marcuse-Kubitza

sql.py: DbConn.col_info(): Fixed bug where is_nullable needed to be cast to a boolean

2820 06/13/2012 08:06 PM Aaron Marcuse-Kubitza

sql.py: cast(): Support string column name inputs

2819 06/13/2012 07:12 PM Aaron Marcuse-Kubitza

sql.py: DbConn: Renamed col_default() to col_info() and have it return a sql_gen.TypedCol object containing all the TypedCol info about the column, not just the default value

2818 06/13/2012 06:55 PM Aaron Marcuse-Kubitza

sql_gen.py: TypedCol: Added default and nullable params

2817 06/13/2012 06:53 PM Aaron Marcuse-Kubitza

dicts.py: Import util after items that util depends on have been defined, to avoid unsatisfied circular dependency

2816 06/13/2012 06:30 PM Aaron Marcuse-Kubitza

sql.py: DbConn.col_default(): Pass the connection to sql_gen.as_Code() so it fixes the syntax on values returned by PostgreSQL

2815 06/13/2012 06:29 PM Aaron Marcuse-Kubitza

sql_gen.py: as_Code(): Added optional db param, which causes the function to run db.std_code() on the value to fix the syntax

2814 06/13/2012 06:27 PM Aaron Marcuse-Kubitza

sql.py: DbConn: Added std_code()

2813 06/13/2012 03:02 PM Aaron Marcuse-Kubitza

db_xml.py: Removed into_table_name() because this functionality is now handled by sql.into_table_name()

2812 06/13/2012 02:59 PM Aaron Marcuse-Kubitza

sql.py: into_table_name(): Also parse hierarchical tables (mappings with a rank column) using a special syntax

2811 06/13/2012 02:44 PM Aaron Marcuse-Kubitza

sql.py: put_table(): Fixed bug where distinct_on included columns that were not in the input table, and were thus incorrectly taken from the LEFT JOINed output table

2810 06/12/2012 10:32 PM Aaron Marcuse-Kubitza

sql.py: track_data_error(): Do nothing if cols are empty, because mk_track_data_error() requires at least one col. mk_track_data_error(): Assert that cols are not empty because VALUES clause requires at least one row.

2809 06/12/2012 10:26 PM Aaron Marcuse-Kubitza

bin/map: by_col: Pass on_error to db_xml.put_table() that calls ex_tracker.track()

2808 06/12/2012 10:14 PM Aaron Marcuse-Kubitza

sql.py: put_table(): No handler for exception: Pass exception to on_error() instead of raising a warning, so that error message can be formatted

2807 06/12/2012 10:08 PM Aaron Marcuse-Kubitza

db_xml.py: put_table(): Pass on_error to sql.put_table()

2806 06/12/2012 10:07 PM Aaron Marcuse-Kubitza

db_xml.py: put_table(): Take on_error param like row-based put()

2805 06/12/2012 10:06 PM Aaron Marcuse-Kubitza

sql.py: put_table(): Take on_error param

2804 06/12/2012 09:48 PM Aaron Marcuse-Kubitza

sql.py: get_cur_query(): Removed no longer used input_params parameter

2803 06/12/2012 09:46 PM Aaron Marcuse-Kubitza

sql.py: Removed unused mogrify()

2802 06/12/2012 09:42 PM Aaron Marcuse-Kubitza

sql.py: DbConn.DbCursor.execute(): Removed no longer used params parameter

2801 06/12/2012 09:32 PM Aaron Marcuse-Kubitza

sql.py: with_autocommit(): Use isolation_level attr and set_isolation_level() method of connection instead of autocommit attr to support older versions of psycopg2

2800 06/12/2012 09:18 PM Aaron Marcuse-Kubitza

sql.py: DbConn.DbCursor.execute(): Only fetch all rows for empty SELECT query, to support older versions of Python that would give a "no results to fetch" error for other types of queries

2799 06/12/2012 09:13 PM Aaron Marcuse-Kubitza

csv2db: When reraising exception, use `raise` instead of `raise e` to preserve whole stack trace

2798 06/12/2012 09:12 PM Aaron Marcuse-Kubitza

sql.py: Removed no longer used _query_lookup()

2797 06/12/2012 09:05 PM Aaron Marcuse-Kubitza

sql.py: DbConn: Cache queries without params, as params are no longer used

2796 06/12/2012 09:03 PM Aaron Marcuse-Kubitza

sql.py: DbConn.is_cached(): Removed no longer used params parameter

2795 06/12/2012 09:01 PM Aaron Marcuse-Kubitza

sql.py: Removed no longer used run_raw_query()

2794 06/12/2012 09:00 PM Aaron Marcuse-Kubitza

sql.py: run_query(): Call db.run_query() directly instead of via run_raw_query()

2793 06/12/2012 08:56 PM Aaron Marcuse-Kubitza

sql.py: DbConn.run_query(): Removed no longer used params parameter

2792 06/12/2012 08:50 PM Aaron Marcuse-Kubitza

sql.py: DbConn._db(): Setting search_path: Use esc_value() instead of params

2791 06/12/2012 08:43 PM Aaron Marcuse-Kubitza

sql.py: run_query(): Removed no longer used params parameter

2790 06/12/2012 08:37 PM Aaron Marcuse-Kubitza

sql.py: run_query_into(): Moved main case (into != None) outside of if statement because the special-case if statement contains `return`

2789 06/12/2012 08:35 PM Aaron Marcuse-Kubitza

sql.py: run_query_into(): Removed no longer used params parameter

2788 06/12/2012 08:32 PM Aaron Marcuse-Kubitza

sql.py: mk_insert_select(): Removed no longer used params parameter

2787 06/12/2012 08:25 PM Aaron Marcuse-Kubitza

sql.py: mk_insert_select(): Return just the query instead of the query plus empty params

2786 06/12/2012 08:22 PM Aaron Marcuse-Kubitza

sql.py: mk_select(): Return just the query instead of the query plus empty params

2785 06/12/2012 08:12 PM Aaron Marcuse-Kubitza

sql.py: tables(): Use select() instead of a custom run_query() to avoid using params, which will be deprecated to make it easier to support old versions of Python

2784 06/12/2012 08:11 PM Aaron Marcuse-Kubitza

sql.py: DbConn.DbCursor.execute(): Require that params are empty, to ensure that code uses db.esc_value() instead. This keeps literal values in the same place as the rest of the query, so that they do not need to be maintained and passed around separately in a params list.

2783 06/12/2012 08:06 PM Aaron Marcuse-Kubitza

sql.py: constraint_cols(): Use db.esc_value() instead of params

2782 06/12/2012 08:05 PM Aaron Marcuse-Kubitza

sql.py: index_cols(): Use db.esc_value() instead of params

2781 06/12/2012 08:00 PM Aaron Marcuse-Kubitza

sql.py: add_pkey(): Use simpler `ADD PRIMARY KEY` syntax to avoid having to create a name for the primary key

2780 06/12/2012 07:57 PM Aaron Marcuse-Kubitza

db_xml.py: put_table(): Subsetting in_table: Add pkey to created temp table to facilitate joining it with intermediate tables

2779 06/12/2012 07:47 PM Aaron Marcuse-Kubitza

sql.py: tables(): Use select() instead of a custom run_query() to avoid using params, which will be deprecated to make it easier to support old versions of Python

2778 06/12/2012 07:14 PM Aaron Marcuse-Kubitza

schemas/postgresql.nimoy.conf: shared_buffers: Fixed syntax error where decimals were not supported

2777 06/12/2012 07:03 PM Aaron Marcuse-Kubitza

sql.py: truncate(): Re-added support for string tables using sql_gen.as_Table(). This fixes empty_db(), which relied on this functionality.

2776 06/12/2012 07:01 PM Aaron Marcuse-Kubitza

sql_gen.py: as_Table(): Added schema param to use as default schema

2775 06/12/2012 06:54 PM Aaron Marcuse-Kubitza

inputs/SALVIAS: Switched to using CSV exports of the DB, so that staging tables could be created for column-based import

2774 06/12/2012 06:48 PM Aaron Marcuse-Kubitza

sql.py: run_query_into(): Added add_indexes_ param which causes the function to add indexes on the created table

2773 06/12/2012 06:18 PM Aaron Marcuse-Kubitza

sql.py: create_table(): Use new add_indexes()

2772 06/12/2012 06:15 PM Aaron Marcuse-Kubitza

sql.py: Added add_indexes()

2771 06/12/2012 05:38 PM Aaron Marcuse-Kubitza

sql.py: get_cur_query(): Fixed bug where strings.ustr() needed to be used instead of str() when ensuring that get_cur_query() returns a string

2770 06/12/2012 05:35 PM Aaron Marcuse-Kubitza

sql.py: cast(): Removed conditional checks for save_errors, since it's now always true if the function got passed the `not save_errors` special case

2769 06/12/2012 05:32 PM Aaron Marcuse-Kubitza

sql.py: cast(): Only convert errors to warnings if errors will be saved in errors_table, so that import will always be aborted if user supplied invalid values in the mappings, even if these values are passed through a relational function

2768 06/12/2012 04:58 PM Aaron Marcuse-Kubitza

sql.py: put_table(): Support inserting tables with all default values, by providing the pkey's default value for all rows so that the SELECT query has at least one column

2767 06/12/2012 04:57 PM Aaron Marcuse-Kubitza

sql_gen.py: is_table_col(): Check that input is a Col object

2766 06/12/2012 04:31 PM Aaron Marcuse-Kubitza

sql.py: put_table(): Assert that mapping is non-empty

2765 06/12/2012 04:23 PM Aaron Marcuse-Kubitza

sql.py: mk_select(): Assert that fields list is non-empty

2764 06/12/2012 04:18 PM Aaron Marcuse-Kubitza

sql.py: DbConn.DbCursor.execute(): Set _is_insert only if query starts with INSERT, so that function definitions containing INSERT are not cached as INSERT statements (exceptions only) themselves

2763 06/12/2012 04:10 PM Aaron Marcuse-Kubitza

sql.py: DbConn.DbCursor.execute(): Fixed bug where params == None would apparently turn off the mogrifier completely, causing "%"s to be excessively escaped, by just setting params to None if it was [] or () and not using strings.esc_for_mogrify() at all

2762 06/12/2012 03:51 PM Aaron Marcuse-Kubitza

sql.py: DbConn.DbCursor.execute(): If not using params, escape the query using strings.esc_for_mogrify() in case any literals contained "%"s

2761 06/12/2012 03:49 PM Aaron Marcuse-Kubitza

strings.py: Added esc_for_mogrify()

2760 06/12/2012 03:05 PM Aaron Marcuse-Kubitza

sql.py: create_table(): Add indexes on all non-pkey columns, unless turned off or deferred using new param col_indexes

2759 06/12/2012 02:46 PM Aaron Marcuse-Kubitza

csv2db: Add column indexes on errors table. Use typed_cols and `.to_Col()` to iterate over columns to add indexes on, for the main and errors tables.

2758 06/11/2012 11:13 PM Aaron Marcuse-Kubitza

sql.py: Added track_data_error(). put_table(): ignore(): Take extra e param for the exception. Use track_data_error() to store the invalid value in the errors table.

2757 06/11/2012 11:11 PM Aaron Marcuse-Kubitza

sql_gen.py: Join.to_str(): Add newline before and after right table if it's been renamed (and therefore takes up multiple lines)

2756 06/11/2012 11:10 PM Aaron Marcuse-Kubitza

exc.py: ExceptionWithCause: Store the cause in an instance variable for later use

2755 06/11/2012 10:47 PM Aaron Marcuse-Kubitza

sql.py: mk_track_data_error(): Rename the errors_table to make the generated SQL less verbose

2754 06/11/2012 10:42 PM Aaron Marcuse-Kubitza

sql.py: mk_insert_select(): Run sql_gen.remove_table_rename() on table to get just the actual name in the DB

2753 06/11/2012 10:42 PM Aaron Marcuse-Kubitza

sql_gen.py: Added remove_table_rename()

2752 06/11/2012 10:40 PM Aaron Marcuse-Kubitza

sql_gen.py: Col: Run `.to_Table()` on table to get just the reference to the table, not any SQL code that defines it

2751 06/11/2012 10:10 PM Aaron Marcuse-Kubitza

sql.py: Added mk_track_data_error() and use it in cast(). This also ensures that if only one source column's row in the CROSS JOIN violates a unique constraint, other source columns' rows are still inserted.

2750 06/11/2012 09:59 PM Aaron Marcuse-Kubitza

sql_gen.py: with_default_table(): Added overwrite param to overwrite the table (if it isn't a NamedCol)

2749 06/11/2012 09:57 PM Aaron Marcuse-Kubitza

sql_gen.py: Join.to_str(): join(): Get just the table name of left_table and right_table using `.to_Table()`. Moved order switching of tables inside join() because the order reversing only applies to an individual condition.

2748 06/11/2012 09:34 PM Aaron Marcuse-Kubitza

sql_gen.py: Renamed set_default_table() to with_default_table() and copy col before modifying it so don't modify input

2747 06/11/2012 09:14 PM Aaron Marcuse-Kubitza

sql_gen.py: Added set_default_table(). as_ValueCond(): Use set_default_table() instead of as_Col() so that any name-only column also gets its table set. Join.to_str(): Parse left side using set_default_table() instead of as_Col() so that any name-only column also gets its table set.

2746 06/11/2012 07:31 PM Aaron Marcuse-Kubitza

sql_gen.py: Join: mapping param defaults to {} for e.g. CROSS JOINs. to_str(): Omit join_cond if mapping is empty, rather than if join is a specific type.

2745 06/11/2012 07:24 PM Aaron Marcuse-Kubitza

sql_gen.py: NamedValues: Change cols to Col objects with the table set to `name`