Project

General

Profile

Statistics
| Revision:

# Date Author Comment
3467 07/18/2012 11:06 PM Aaron Marcuse-Kubitza

Autogenerated SQL code: Use new strings.indent() where needed

3466 07/18/2012 11:05 PM Aaron Marcuse-Kubitza

strings.py: Added indent()

3465 07/18/2012 10:50 PM Aaron Marcuse-Kubitza

sql_io.py: data_exception_handler(): Refactored to use sql_gen.RowExcIgnore

3464 07/18/2012 10:31 PM Aaron Marcuse-Kubitza

sql_io.py: cast(): Refactored to use sql_gen.FunctionDef

3463 07/18/2012 10:28 PM Aaron Marcuse-Kubitza

sql_gen.py: ExcHandler: Removed extra newline after handler

3462 07/18/2012 10:27 PM Aaron Marcuse-Kubitza

sql.py: mk_insert_select(): ignore: RETURN QUERY statement: Added back missing newline after ';'

3461 07/18/2012 10:23 PM Aaron Marcuse-Kubitza

sql_gen.py: FunctionDef: Added support for parameters

3460 07/18/2012 10:03 PM Aaron Marcuse-Kubitza

sql_io.py: cast(): Just use the first word of the type in the function name to help avoid name collisions. Note that type name collisions that may be introduced by this change are not a problem because the function name is versioned. (The caching mechanism prevents versioning when the function has the same name and definition as an already-defined function.)

3459 07/18/2012 09:59 PM Aaron Marcuse-Kubitza

sql_io.py: Added data_exception_handler() and use it in cast()

3458 07/18/2012 09:58 PM Aaron Marcuse-Kubitza

sql_gen.py: ExcHandler.to_str(): Removed extra newline after body

3457 07/18/2012 08:41 PM Aaron Marcuse-Kubitza

sql_gen.py: ExcHandler: Added repr() since it's not a Code object

3456 07/18/2012 08:17 PM Aaron Marcuse-Kubitza

sql_gen.py: FunctionDef: Support custom function modifiers

3455 07/18/2012 08:04 PM Aaron Marcuse-Kubitza

sql_gen.py: RowExcIgnore: Changed exc param to exc_handler to allow user to specify handler code for the exception

3454 07/18/2012 08:01 PM Aaron Marcuse-Kubitza

sql_gen.py: Added ExcHandler, unique_violation_handler

3453 07/18/2012 07:53 PM Aaron Marcuse-Kubitza

sql_gen.py: RowExcIgnore: Don't automatically add 'RETURN QUERY' before the with_row code or ';' after it

3452 07/18/2012 07:02 PM Aaron Marcuse-Kubitza

sql_gen.py: RowExcIgnore: Allow user to specify a custom row var name

3451 07/18/2012 06:55 PM Aaron Marcuse-Kubitza

sql_gen.py: FunctionDef: Don't automatically add 'SETOF ' before the return type

3450 07/18/2012 06:44 PM Aaron Marcuse-Kubitza

sql.py: mk_insert_select(): embeddable: Use new sql_gen.RowExcIgnore

3449 07/18/2012 06:44 PM Aaron Marcuse-Kubitza

sql_gen.py: Added RowExcIgnore

3448 07/18/2012 06:12 PM Aaron Marcuse-Kubitza

sql_gen.py: FunctionDef: Determine the lang from the body's Code object instead of receiving it as a parameter

3447 07/18/2012 06:10 PM Aaron Marcuse-Kubitza

sql_gen.py: as_Code(): Fixed bug where needed to handle inputs that are already Code objects

3446 07/18/2012 05:52 PM Aaron Marcuse-Kubitza

sql_gen.py: Code: Added lang instance var

3445 07/18/2012 05:49 PM Aaron Marcuse-Kubitza

sql_gen.py: Fixed bug where Code subclasses needed to call Code.__init__() in their init() function. BasicObject: Fixed bug where init() expected a value param, when in fact the value param is something added by certain subclasses.

3444 07/18/2012 05:31 PM Aaron Marcuse-Kubitza

sql_gen.py: FunctionDef: body param: Support Code inputs in addition to strings

3443 07/18/2012 05:14 PM Aaron Marcuse-Kubitza

sql.py: mk_insert_select(): embeddable: Use new sql_gen.FunctionDef

3442 07/18/2012 05:13 PM Aaron Marcuse-Kubitza

sql_gen.py: Added FunctionDef

3441 07/18/2012 03:49 PM Aaron Marcuse-Kubitza

README.TXT: Schema changes: Documented how to reinstall errors tables

3440 07/18/2012 03:46 PM Aaron Marcuse-Kubitza

csv2db: Creating errors table: Only drop existing errors table in errors_table_only mode, so that errors tables are not unintentionally deleted when `make inputs/install` is run. This helps to make `make install` idempotent.

3439 07/18/2012 03:40 PM Aaron Marcuse-Kubitza

README.TXT: Maintenance: Full DB: Changed commands to autorotate the created backup and then test and restore a rotated backup

3438 07/18/2012 03:31 PM Aaron Marcuse-Kubitza

backups/Makefile: Added %.backup/rotate

3437 07/18/2012 02:58 PM Aaron Marcuse-Kubitza

backups/Makefile: Rearranged sections so that backup targets, which apply to both Archived imports and Full DB, are at the top of a common Backups section

3436 07/18/2012 02:54 PM Aaron Marcuse-Kubitza

inputs/import.stats.xls: Updated with stats from latest import

3435 07/17/2012 11:09 PM Aaron Marcuse-Kubitza

schemas/py_functions.sql: Disabled _date() because it does not yet output errors in a format parsable by the import process, and the import process does not yet trap errors produced by SQL functions

3434 07/17/2012 11:00 PM Aaron Marcuse-Kubitza

sql_io.py: put_table(): Determining if can use optimization for only literal values: Fixed bug where needed initial value for reduce()

3433 07/17/2012 10:52 PM Aaron Marcuse-Kubitza

sql_io.py: put_table(): Needing >= one column for INSERT SELECT: Fixed bug where can't add pkey column if calling a function instead of outputting to a table

3432 07/17/2012 10:36 PM Aaron Marcuse-Kubitza

sql_io.py: put_table(): Optimization for only literal values: Also support an empty in_tables list, for use by put()

3431 07/17/2012 10:20 PM Aaron Marcuse-Kubitza

sql_io.py: put_table(): Added optimization for only literal values, which does the same operations as put() but with the additional error handling of put_table()

3430 07/17/2012 10:17 PM Aaron Marcuse-Kubitza

pg_dump_vegbien: Don't use SET SESSION AUTHORIZATION because it doesn't work with the py_functions schema (it requires PL/Python functions to be created as user postgres and then the owner changed to bien, which SET SESSION AUTHORIZATION won't do)

3429 07/17/2012 08:53 PM Aaron Marcuse-Kubitza

sql_gen.py: Added is_literal() and use it where isinstance(..., Literal) is used

3428 07/17/2012 08:44 PM Aaron Marcuse-Kubitza

db_xml.py: put_table(): Divide fields into input columns and literal values: Translate values: Allow literal values other than strings or None (from the XML parsing), because sql_io.put_table() is getting an optimization for iterations containing only literal values, which just returns the pkey of the single row for these values (which is usually an integer) instead of a temp table with the same value in each row

3427 07/17/2012 08:28 PM Aaron Marcuse-Kubitza

bin/map: by_col: Stripping XML functions not in the DB: Remove DB functions based on whether a plain SQL function of that name exists, rather than whether a relational function (i.e. a table) of that name exists. This will allow column-based import to use plain SQL functions that don't have a corresponding relational function.

3426 07/17/2012 08:23 PM Aaron Marcuse-Kubitza

db_xml.py: Don't remove any explicit pkey because the output table may be a SQL function, which does not have a pkey. This feature only existed to support importing VegBank XML exports, which we don't use (and which would be incompatible with the schema anyway).

3425 07/17/2012 08:19 PM Aaron Marcuse-Kubitza

sql.py: function_exists(): Fixed bug where select() needed to be run with auto-rollback in case it raised an exception

3424 07/17/2012 08:08 PM Aaron Marcuse-Kubitza

xml_func.py: process(): Changed rel_funcs param to a callback is_rel_func, so that caller can specify any dynamic function to determine if a name is a relational function rather than having to list out all known relational functions

3423 07/17/2012 07:54 PM Aaron Marcuse-Kubitza

sql.py: function_exists(): Use simpler cast to regproc instead of query of information_schema.routines to determine if function exists. When the schema is not specified, this also limits the schemas checked to the search_path instead of the whole DB.

3422 07/17/2012 07:51 PM Aaron Marcuse-Kubitza

schemas/functions.sql, py_functions.sql: Renamed trigger functions to avoid collisions with plain SQL functions of the same name but different signatures, so that the plain SQL functions can be uniquely identified by their name without also requiring their signature

3421 07/17/2012 07:39 PM Aaron Marcuse-Kubitza

sql.py: mk_select(): In queries without a FROM clause, don't order by pkey

3420 07/17/2012 07:15 PM Aaron Marcuse-Kubitza

sql.py: mk_select(): Support queries without a FROM clause

3419 07/17/2012 07:03 PM Aaron Marcuse-Kubitza

sql.py: Added DoesNotExistException and parse it in run_query()

3418 07/17/2012 06:46 PM Aaron Marcuse-Kubitza

sql_io.py: put_table(): Removed no longer used conds var (invalid rows are removed from the in_table using sql.delete() instead of being filtered out in the main select)

3417 07/17/2012 06:43 PM Aaron Marcuse-Kubitza

sql_io.py: put_table(): Removed no longer used distinct_on var (sql.distinct_table() handles filtering the join_cols)

3416 07/17/2012 06:24 PM Aaron Marcuse-Kubitza

schemas/py_functions.sql: _date(): Just run str() on the returned datetime because it will usually be converted to a PostgreSQL timestamp anyway, so excluding the time from the string isn't necessary

3415 07/17/2012 06:15 PM Aaron Marcuse-Kubitza

schemas/py_functions.sql: Added _date()

3414 07/17/2012 06:14 PM Aaron Marcuse-Kubitza

sql.py: run_query(): Exception parsing: Remove PL/Python prefix from exception message so that the regexps can match at the beginning of the message

3413 07/17/2012 05:50 PM Aaron Marcuse-Kubitza

sql_io.py: put_table(): Handle sql.InvalidValueExceptions by filtering the value out of all input columns. This will be useful for SQL functions that raise exceptions.

3412 07/17/2012 04:49 PM Aaron Marcuse-Kubitza

schemas/vegbien.sql: namedplace, plantname: *_unique UNIQUE INDEX: Reordered columns to put rank after parent_id and plantname so that these columns, which are usually input table columns, can be used in a merge join index scan, while rank, which is usually a literal value, can applied as an index filter condition after the merge join

3411 07/17/2012 04:42 PM Aaron Marcuse-Kubitza

sql.py: distinct_table(): Removed literal values from UNIQUE INDEXes because the query planner did not seem to use them to do a merge join

3410 07/17/2012 04:01 PM Aaron Marcuse-Kubitza

README.TXT: Maintenance: Full DB: Documented how to test full DB backup

3409 07/17/2012 03:47 PM Aaron Marcuse-Kubitza

backups/Makefile: Added %.backup/test

3408 07/16/2012 08:32 PM Aaron Marcuse-Kubitza

README.TXT: Documented maintenance of full DB (back up/restore)

3407 07/16/2012 08:23 PM Aaron Marcuse-Kubitza

backups/Makefile: Full DB backups: Added vegbien.backup

3406 07/16/2012 08:22 PM Aaron Marcuse-Kubitza

pg_dump_vegbien: If first arg is "all", dump entire DB. Require a first arg so that Usage message will be displayed if run with no args.

3405 07/16/2012 08:03 PM Aaron Marcuse-Kubitza

Always output Usage messages to stderr and word-wrap them using `fold -s`

3404 07/16/2012 07:37 PM Aaron Marcuse-Kubitza

backups/Makefile: Factored backup command into $(backup) for later use by full DB backups. Made Backups, Archived imports sections subsections of Archived imports so Full DB backups can have its own section.

3403 07/16/2012 07:16 PM Aaron Marcuse-Kubitza

backups/Makefile: Fixed bug where $(SHELL) needed to be set to bash so that $'\n' would be interpreted correctly

3402 07/16/2012 07:06 PM Aaron Marcuse-Kubitza

backups/Makefile: Fixed bug where *.sql files needed to be restored using psql because pg_restore only supports "non-plain-text formats"

3401 07/16/2012 06:35 PM Aaron Marcuse-Kubitza

pg_dump_vegbien: For consistency with setting the --schema option, use `set -- "$" args...` to append options to $ which are then passed to pg_dump, instead of specifying several variables which are then included in the pg_dump command

3400 07/16/2012 06:26 PM Aaron Marcuse-Kubitza

pg_dump_vegbien: Pass command line options directly to pg_dump after parsing out any schema name

3399 07/16/2012 06:19 PM Aaron Marcuse-Kubitza

backups/Makefile: Don't log stderr or run the command verbosely and instead just output the command and run time to the terminal. This matches what we do for pg_dump, which works better because it just prints the useful information when it's done running.

3398 07/16/2012 05:28 PM Aaron Marcuse-Kubitza

backups/Makefile: Remove log files after successful restore/extraction because they are only useful for tail -f when the restore operation is running in the background

3397 07/16/2012 05:14 PM Aaron Marcuse-Kubitza

pg_dump_vegbien: Save owners when saving data (for full export)

3396 07/16/2012 05:03 PM Aaron Marcuse-Kubitza

pg_dump_vegbien: Use SET SESSION AUTHORIZATION to ensure that owners are always recorded in the same format. This will help make plain text backups comparable using diff.

3395 07/16/2012 04:39 PM Aaron Marcuse-Kubitza

backups/Makefile: Backups: Fixed bug where `%.sql: %` needed to come before %.sql with no prerequisites to be matched first

3394 07/16/2012 04:14 PM Aaron Marcuse-Kubitza

Moved archived imports and make targets to maintain them to new backups dir

3393 07/16/2012 04:08 PM Aaron Marcuse-Kubitza

Moved archived imports and make targets to maintain them to new backups dir

3392 07/16/2012 03:29 PM Aaron Marcuse-Kubitza

Added psql_script_vegbien

3391 07/16/2012 12:54 PM Aaron Marcuse-Kubitza

root Makefile: VegBIEN DB: Schemas: Added schemas/%.sql to extract a compressed custom-format backup to plain SQL

3390 07/16/2012 12:33 PM Aaron Marcuse-Kubitza

root Makefile: VegBIEN DB: Schemas: Added schemas/%.backup/uninstall so that a schema can be removed by its backup file name (with extension) as well as its name

3389 07/13/2012 04:43 PM Aaron Marcuse-Kubitza

README.TXT: Documented that files and directories can easily be remade with `make <file>-remake` and `make <dir>/remake`, which do the make clean or rm automatically

3388 07/13/2012 04:37 PM Aaron Marcuse-Kubitza

pg_dump_vegbien: Added plain env var which creates plain text output instead, for use in debugging and validation

3387 07/13/2012 04:14 PM Aaron Marcuse-Kubitza

input.Makefile: Mapping: $(map): Fixed bug where use_staged was causing in_schema, in_database, etc. to be set even when not outputting to vegbien, causing bin/map to try to output to a DB when it should output to stdout, by moving the use_staged test to $(map2db)

3386 07/13/2012 03:07 PM Aaron Marcuse-Kubitza

sql_io.py: put_table(): Creating full_in_table: If out_table is a SQL function, just use in_table because in_table is not modified

3385 07/13/2012 02:47 PM Aaron Marcuse-Kubitza

input.Makefile: Documentation: import/steps.by_col.sql: $(steps): Fixed bug where stderr needed to be redirected to stdout so that it would be passed to debug2redmine and included in the file

3384 07/13/2012 02:26 PM Aaron Marcuse-Kubitza

root Makefile: Datasources: import: Don't pause after "To import all inputs at once" message because this prevents running sequential import with & (as `make import &`)

3383 07/13/2012 02:09 PM Aaron Marcuse-Kubitza

sql.py: create_table(): Only version temp tables, so that e.g. staging tables are not created with a version # if they already exist. This will help make `make install` idempotent.

3382 07/13/2012 02:00 PM Aaron Marcuse-Kubitza

input.Makefile: Import to VegBIEN: $(import): Only redirect stderr to stdout if outputting to a log file. This allows unlogged imports to redirect the "Inserted # new rows into database" message, which is output to stdout rather than stderr for use by validation and automated testing, to a separate location.

3381 07/13/2012 01:54 PM Aaron Marcuse-Kubitza

README.TXT: Documented how to remove an archived import. Moved archived imports commands from Data import to new section Maintenance of archived imports. Changed "Empty the DB" to "Remove the last import" for clarity, and made the command apply just to the public schema and not also to the functions schemas (reinstalling those is documented under Schema changes).

3380 07/13/2012 01:44 PM Aaron Marcuse-Kubitza

root Makefile: $(rmSchemaCmd) for uninstalling schemas: Escape schema name with "" so that schemas/%/uninstall can be used to remove archived imports (as well as aborted restores of them)

3379 07/13/2012 01:14 PM Aaron Marcuse-Kubitza

root Makefile: schemas/%.backup: Removed explicit check if file exists because now that the target name matches the name of the file created, the file will be rebuilt only if it doesn't exist

3378 07/13/2012 01:13 PM Aaron Marcuse-Kubitza

schemas: Ignore log files (from restore operations) for svn

3377 07/13/2012 12:49 PM Aaron Marcuse-Kubitza

main Makefile: Installation: install: Download input data using new inputs/download target

3376 07/13/2012 12:48 PM Aaron Marcuse-Kubitza

main Makefile: VegBIEN DB: Schemas: schemas/%/install, schemas/py_functions/install: Ignore errors if schema exists, so that install can be idempotent

3375 07/13/2012 12:38 PM Aaron Marcuse-Kubitza

inputs/Makefile: Added download to download input data from vegbiendev

3374 07/13/2012 10:05 AM Aaron Marcuse-Kubitza

main Makefile: VegBIEN DB: Removing database warning message: Changed "public schema versions" to "archived imports" for clarity

3373 07/13/2012 10:01 AM Aaron Marcuse-Kubitza

main Makefile: VegBIEN DB: Schemas: Added schemas/%.backup/restore and documented it in README.TXT

3372 07/13/2012 09:42 AM Aaron Marcuse-Kubitza

inputs/import.stats.xls: Updated with stats from latest import. Marked partial imports affecting the slowest datasource with a comment when they might otherwise appear to be comparable with full imports due to having a similar # of rows.

3371 07/13/2012 08:58 AM Aaron Marcuse-Kubitza

root Makefile: schemas/%.backup: Removed _always prerequisite because an existing backup should not be overwritten by running `make schemas/%.backup`

3370 07/13/2012 08:53 AM Aaron Marcuse-Kubitza

README.TXT: Updated warning messages to match what's actually output by the commands in question

3369 07/13/2012 08:47 AM Aaron Marcuse-Kubitza

README.TXT: Documented how to back up an archived import

3368 07/12/2012 03:26 PM Aaron Marcuse-Kubitza

root Makefile: VegBIEN DB: Schemas: schemas/%/backup: Time the backup