Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Commits on Jun 30, 2011
  1. @jmafc

    Update release files for 0.3.0.

    jmafc authored
  2. @jmafc

    Add support for SECURITY DEFINER functions.

    jmafc authored
     * pyrseas/dbobject/ (Function.create): Output SECURITY
       DEFINER if needed.  (ProcDict.query): Retrieve prosecdef.
     * tests/dbobject/ New tests for SECURITY DEFINER
Commits on Jun 29, 2011
  1. @jmafc

    Add support for functions returning table row types.

    jmafc authored
     * docs/table.rst: Add automethod for Table.drop.
     * pyrseas/dbobject/ (Function.to_map): Don't expose
       dependent_table.  (Function.create): If function has a dependent
       table, create that first.
     * pyrseas/dbobject/ (SchemaDict.link_refs): Add
       dependent_table attribute to functions returning row types, and
       link back the tables to the function.
     * pyrseas/dbobject/ (Table.create): Add a created attribute
       to bypass duplicate creation.  (Table.drop): New method so any
       dependent functions can be dropped before the table itself.
     * tests/dbobject/ New tests for void function and
       functions returning a set of rows.
Commits on Jun 24, 2011
  1. @jmafc

    Correct order of dropping certain database objects.

    jmafc authored
     * pyrseas/ (Database.diff_map): Drop functions before
       schemas and add dropping of types.
     * pyrseas/dbobject/ (ColumnDict.query): Use pg_get_expr() to
       get DEFAULT.
     * pyrseas/dbobject/ (ConstraintDict.diff_map): Skip
       domains when dropping CHECK constraints.
     * pyrseas/dbobject/ (TypeDict.diff_map): Don'd drop types
       yet.  (TypeDict._drop): New method to actually drop the types.
     * pyrseas/dbobject/ (Sequence.get_dependent_table): Renamed
       from get_owner. Add query against pg_depend and pg_attrdef to
       determine the dependent table (when an owner table isn't present).
       (Sequence.to_map): Don't map dependent_table.
       (ClassDict._from_catalog): Change get_owner to get_dependent_table.
       (ClassDict.diff_map): Drop rules. If a sequence has a dependent
       table, postpone dropping it until after the tables are dropped.
Commits on Jun 23, 2011
  1. @jmafc

    Add support for creation of indexes using expressions.

    jmafc authored
     * pyrseas/dbobject/ (Index.create): Use key_columns() or
       expression depending on existence of keycols.
       (IndexDict.from_map): Check whether columns or expression is
     * tests/dbobject/ New test to verify creation of
       indexes on expressions and failing when neither column or
       expression is in the input map.
Commits on Jun 22, 2011
  1. @jmafc

    Add support for indexes on expressions. Fixes issue #3.

    jmafc authored
     * pyrseas/dbobject/ (Index.to_map): Make key columns
       specification conditional.  (IndexDict.query): Add expression to
       target list.  (IndexDict._from_catalog): Eliminate keycols if array
       is zero.
     * tests/dbobject/
       (IndexToMapTestCase.test_index_function): New test for indexes on
  2. @jmafc

    Triggers should be dropped before the corresponding functions.

    jmafc authored
     * pyrseas/ (Database.diff_map): Add call to
     * pyrseas/dbobject/ (ProcDict.diff_map): Only mark
       functions for dropping.  (ProcDict._drop): New function to actually
       drop the functions.
  3. @jmafc

    Add support for rewrite rules.

    jmafc authored
     * docs/index.rst: Add rule.rst.
     * docs/rule.rst: New page to document rule objects.
     * pyrseas/ (Database.Dicts.__init__): Initialize RuleDict.
       (Database._link_refs): Add rules argument to tables.link_refs.
       (Database.diff_map): Add call to rules.diff_map.
     * pyrseas/dbobject/ New module to implement rule support.
     * pyrseas/dbobject/ (Table.to_map, ClassDict.from_map):
       Handle rules if present.  (ClassDict.link_refs): Add dbrules
       argument and process it.  (ClassDict.diff_map): Handle dropping of
     * tests/dbobject/ Invoke rule tests.
     * tests/dbobject/ New test module.
Commits on Jun 17, 2011
  1. @jmafc

    Add support for AGGREGATE functions and enhance regular functions.

    jmafc authored
     * docs/function.rst: Add documentation for Procedure and Aggregate,
       change FunctionDict to ProcDict.
     * pyrseas/ (Database.Dicts.__init__): Change FunctionDict
       to ProcDict.  (Database._link_refs): Add call to
       languages.link_refs.  (Database.diff_map): Move call to diff_map
       for functions before the one for tables.
     * pyrseas/dbobject/ (ConstraintDict.diff_map): Skip
       DOMAIN constraints.
     * pyrseas/dbobject/ (Proc): New class to inherit from
       DbSchemaObject, have Function and new class Aggregate derive from
       Proc.  (Aggregate): New class to implement AGGREGATE functions.
       (ProcDict): Renamed from FunctionDict and changed to support
     * pyrseas/dbobject/ (Language.to_map): Don't expose
       functions in the language, they'll show up under the schema.
       (LanguageDict.link_refs): Get language for functions and properly
       link them.
     * pyrseas/dbobject/ (SchemaDict.from_map): Handle aggregates
       when present.
     * pyrseas/dbobject/ (Sequence): Remove redundant keylist.
     * tests/dbobject/ Add tests for AGGREGATEs and
       adjust function tests for possible SET check_function_bodies.
     * tests/dbobject/ Add test for dropping function and
       language together.
     * tests/dbobject/ Adjust tests for possible SET
       check_function_bodies statement.
Commits on Jun 10, 2011
  1. @jmafc

    Add support for enumerated types.

    jmafc authored
     * docs/type.rst: Add Enum documentation.
     * pyrseas/dbobject/ (Enum): New class.  (TypeDict.query):
       Fetch enum labels from pg_enum.  (TypeDict._fromCatalog):
       Reinitialize Enum's.  (TypeDict.from_map): Map input enumerated
       types.  (TypeDict.diff_map): Remove limitation to domains.
     * pyrseas/dbobject/ (Schema.to_map): Map types if present.
       (SchemaDict.from_map): Handle types.  (SchemaDict.link_refs): Link
       enums to schema.types and fix
     * tests/dbobject/ Invoke type tests.
     * tests/dbobject/ New test module.
     * tests/dbobject/ (PostgresDb.clear): Drop types.
Commits on Jun 8, 2011
  1. @jmafc

    Add support for domains.

    jmafc authored
     * docs/index.rst: Add type.rst.
     * docs/table.rst: Remove note about views.
     * docs/type.rst: New page to document types and domains.
     * pyrseas/ (Database.Dicts.__init__): Add dictionary for
       types.  (Database._link_refs): Add types argument when calling
       schemas.link_refs.  (Database.diff_map): Call types.diff_map.
     * pyrseas/dbobject/ (CheckConstraint.to_map): Delete
       target attribute if present. Dbcols argument may be None.
       (ConstraintDict.query): Adjust 'table' to cover both tables and
       domains and add 'target' to differentiate domains from tables.
       (ConstraintDict.from_map): New argument 'target' for domains.
     * pyrseas/dbobject/ New module to implement domains.
     * pyrseas/dbobject/ (Schema.to_map): Map domains if present.
       (SchemaDict.from_map): Handle domains and types.
       (SchemaDict.link_refs): Add dbtypes argument and traverse it to
       link domains.
     * pyrseas/dbobject/ (ClassDict.link_refs): Use 'target'
       attribute to skip over domains.
     * tests/dbobject/ Invoke domain tests.
     * tests/dbobject/ New test module.
     * tests/dbobject/ ((PostgresDb.clear): Drop domains.
Commits on Jun 7, 2011
  1. @jmafc

    Merge branch 'r0.2'

    jmafc authored
  2. @jmafc

    Update NEWS for release 0.2.1.

    jmafc authored
  3. @jmafc

    Deal with dropped columns by retrieving attisdropped. Fixes issue #2.

    jmafc authored
     * pyrseas/dbobject/ (Column.to_map): Return None if column
       has been dropped.  (Column.drop): Return empty statement if column
       dropped. (ColumnDict.query): Retrieve attisdropped instead of
       restricting on it.
     * pyrseas/dbobject/ (Table.to_map): Skip columns that have
       been dropped.
     * tests/dbobject/ (ForeignKeyToMapTestCase): Two
       new test cases, for multiple foreign keys and foreign keys where
       columns have been dropped.
Commits on May 27, 2011
  1. @jmafc

    Don't provide host/port defaults in order to use sockets for local te…

    jmafc authored
     * pyrseas/ (DbConnection.__init__): If host is None, or localhost, and if port is None or 5432, don't include
       them in the connection string.  (DbConnection.connect):
       and self.port now have part of the connection string.
     * tests/dbobject/ (pgconnect): If host is None, or
       localhost, and if port is None or 5432, don't include them in the
       connection string. (TEST_HOST, TEST_PORT): Use None as defaults.
       (PostgresDb.__init__): Adjust for possible port being None.
Commits on May 26, 2011
  1. @jmafc

    Add support for triggers.

    jmafc authored
     * docs/index.rst: Add trigger.rst.
     * docs/trigger.rst: New page to document triggers.
     * pyrseas/ (Database.Dicts.__init__): Add dictionary for
       triggers.  (Database._link_refs): Add triggers argument when
       calling tables.link_refs.  (Database.diff_map): Call
     * pyrseas/ (DbConnection.connect): Convert version to int.
     * pyrseas/dbobject/ Miscellaneous cleanup.
     * pyrseas/dbobject/ (Table.to_map, ClassDict.from_map):
       Handle triggers if present.  (ClassDict.link_refs): New dbtriggers
       argument.  (ClassDict.diff_map): Drop triggers before dropping
     * pyrseas/dbobject/ New module to implement feature.
     * tests/dbobject/ Invoke trigger tests.
     * tests/dbobject/
       (FunctionToMapTestCase.test_map_function_with_args): Remove
       'arguments' from map.
     * tests/dbobject/ New test module.
     * tests/dbobject/ (PostgresDb.clear): Drop PL/pgSQL if
       installed and version before 9.0.
       (PostgresDb.is_plpgsql_installed): New method.
Commits on May 19, 2011
  1. @jmafc

    Update NEWS for release 0.2.0.

    jmafc authored
  2. @jmafc

    Changes for release 0.2.0 and distribution via PGXN.

    jmafc authored
     * .gitignore: Add 'build' subdirectory.
     * Include Makefile and META.json.
     * META.json: New file required by PGXN.
     * Makefile: New file needed by PGXN.
     * docs/ Change version/release identifiers.
     * docs/index.rst: Add install.rst.
     * docs/install.rst: New file documenting installation procedures.
     * Change version.
Commits on May 17, 2011
  1. @jmafc

    Add support for testing against multiple PostgreSQL versions.

    jmafc authored
     * docs/dbconn.rst: Document new version property.
     * pyrseas/ (Database.diff_map): Pass version as argument
       to languagues.diff_map.
     * pyrseas/ (DbConnection): Add version as property, fetch on
     * pyrseas/dbobject/ (LanguageDict.diff_map): Add dbversion
       parameter and use it to special case plpgsql.
       (LanguageDict._drop): Fix leftover code pasted from SchemaDict.
     * tests/dbobject/
       (ForeignKeyToMapTestCase.test_cross_schema_foreign_key): Split
       expected maps to version diffs due to plpgsql.
       (UniqueConstraintToMapTestCase): Adjust map_unique2 for different
       default constraint naming between versions.
     * tests/dbobject/ (pgconnect): Do not specify parameter
       defaults.  (PostgresDb.__init__): New arguments/attributes user,
       host and port and internal attribute _version.
       (PostgresDb.connect): Always close the admin connection. Fetch
       server_version_num.  (PostgresDb.version): New property.
       (PostgresDb.{connect,create,drop}): Add new arguments to pgconnect
       calls.  (PostgresDb.{execute_and_map,process_map}): Pass user, host
       and port to DbConnection.  (PyrseasTestCase.setUp): Parameterize
       PostgresDb creation using environment variables.
Commits on May 13, 2011
  1. @jmafc

    Add basic support for functions.

    jmafc authored
     * docs/dbobject.rst: Add new automethods and remove refactored
     * docs/function.rst: New file to document functions.
     * docs/index.rst: Add function.rst.
     * pyrseas/ (Database.Dicts.__init__): Add functions.
       (Database.{_link_refs,from_catalog,from_map}): Refactor code into
       new internal method.  (Database.diff_map): Call functions.diff_map.
     * pyrseas/dbobject/ (DbObject.{identifier,comment,drop}):
       New identifier method for use by comment and drop.
       (DbObject.diff_description): Refactored from
       (DbSchemaObject.identifier): New method override.
       (DbSchemaObject.comment): Removed.  (DbSchemaObject.drop): Updated
       to use new identifier method.
     * pyrseas/dbobject/ New module for added functionality.
     * pyrseas/dbobject/ (Schema.to_map): Handler functions.
       (Schema.from_map): Split input schema into table-related objects
       and functions.  (Schema.link_refs): Add dbfunctions argument and
       handle it.
     * pyrseas/dbobject/ (DbClass.diff_description): Removed.
     * tests/dbobject/ Invoke function tests.
     * tests/dbobject/ New test module.
     * tests/dbobject/ (PostgresDb.clear): Add code to drop
       existing functions.
Commits on May 11, 2011
  1. @jmafc
  2. @jmafc

    Add basic support for procedural languages.

    jmafc authored
     * docs/dbobject.rst: Add refactored automethods for DbObject.
     * docs/index.rst: Add language entry.
     * docs/language.rst: New file to document language classes.
     * docs/schema.rst: Remove refactored automethods from Schema.
     * pyrseas/ (Database.Dicts.__init__): Initialize a
       LanguageDict. (Database.from_map): Split input map into schemas and
       languages.  (Database.to_map): Construct the output map in two
       stages.  (Database.diff_map): Add support for languages.
     * pyrseas/dbobject/ Refactor extern_key from
       DbSchemaObject (and Schema) to DbObject. Refactor comment, drop and
       rename methods from Schema into DbObject.
     * pyrseas/dbobject/ New module for procedural languages.
     * pyrseas/dbobject/ (Schema): Remove extern_key, comment,
       drop and rename methods.
     * tests/dbobject/ Invoke language tests.
     * tests/dbobject/ New test module.
Commits on May 6, 2011
  1. @jmafc

    Add support for inherited tables.

    jmafc authored
     * pyrseas/dbobject/ (split_schema_table): New utility
       function split schema-qualified names.  (DbSchemaObject.unqualify):
       Use new function.
     * pyrseas/dbobject/ (Column.to_map): Map inherited columns.
       (ColumnDict.query): Retrieve attinhcount as 'inherited'.
     * pyrseas/dbobject/ (ConstraintDict._from_catalog):
       Recall code by call to split_schema_table.
     * pyrseas/dbobject/ (Sequence.get_owner): Replace code by
       call to split_schema_table.  (Table.to_map): Map inherited tables.
       (Table.create): Add INHERITS clause and deal with inherited
       columns.  (ClassDict.inhquery): New query from pg_inherits.
       (ClassDict._from_catalog): Fetch inheritance info.
       (ClassDict.from_map): Map 'inherits' info.  (ClassDict.link_refs):
       Add links for descendant tables.  (ClassDict.diff_map): Deal with
       inherited tables, both for create and drop.
     * tests/dbobject/  Add tests for inherited tables.
     * tests/dbobject/ (PostgresDb.clear): Use IF EXISTS for
       dropping tables.
Commits on Apr 29, 2011
  1. @jmafc

    Add support for views.

    jmafc authored
     * docs/database.rst: Add view entry to example map. Add and correct
       references to lower level maps.
     * docs/table.rst: Add autoclass/method under Database Class. Fix
       example table map. Add section for class View.
     * pyrseas/dbobject/ (Schema.to_map, SchemaDict.link_refs):
       Add code for dealing with views.
     * pyrseas/dbobject/ (DbClass.diff_description): New method to
       abstract handling of comments for tables, sequences or views.
       (Table.diff_map): Call new method (to which the code was moved).
       (View): New class for views.  (ClassDict.query): Add view
       definition to target list and include relkind == 'v' in
       restriction.  (ClassDict._from_catalog): Instantiate View objects.
       (ClassDict.from_map): Handle view objects.  (ClassDict.diff_map):
       Add handling for views.
     * tests/dbobject/ Call test_view suite.
     * tests/dbobject/ (SchemaToSqlTestCase.
       test_drop_schema): Late fix to remove CASCADE.
     * tests/dbobject/ Correct header comment.
     * tests/dbobject/ New module to test new functionality.
     * tests/dbobject/ (fix_indent): Ensure strings of multiple
       spaces are handled correctly.  (PostgresDb.clear): Include views in
       objects to drop.  (PostgresDb.execute): Remove leftover print.
Commits on Apr 26, 2011
  1. @jmafc

    Correct dropping of PRIMARY KEYs that are still being referenced.

    jmafc authored
     * pyrseas/dbobject/ (ClassDict.diff_map): Drop all FOREIGN
       KEYs separately first, then drop all other subordinate objects
       and the table itself.
Commits on Apr 22, 2011
  1. @jmafc

    Possibly temporary solution to dropping schemas.

    jmafc authored
     * pyrseas/ (Database.diff_map): Call new SchemaDict._drop
       before returning.
     * pyrseas/dbobject/ (Schema.drop): Don't use CASCADE.
       (SchemaDict.diff_map): Only mark schemas to be dropped.
       (SchemaDict._drop): New method to actually DROP the schemas.
  2. @jmafc
Commits on Apr 21, 2011
  1. @jmafc
Commits on Apr 20, 2011
  1. @jmafc

    Add support for RENAME COLUMN.

    jmafc authored
     * docs/column.rst: Add automethod Column.rename.
     * pyrseas/dbobject/ (DbSchemaObject.rename): Document
       missing parameter newname.
     * pyrseas/dbobject/ (Column.to_map): Delete _table from the
       external dictionary.  (Column.comment): Eliminate tbl argument and
       use internal _table link argument instead.  (Column.rename): New
       method to return ALTER TABLE RENAME COLUMN.  (ColumnDict.diff_map):
       Correct for loop to use all key values.
     * pyrseas/dbobject/ (Table.create): Don't pass self as
       argument to Column.comment.  (Table.diff_map): Check for and
       process possible column RENAME.  (ClassDict.link_refs): Add a
       _table back link from each column to the containing table.
       (ClassDict._rename): Copy the old table/sequence to the new one
       before deleting the old.
     * tests/dbobject/ (ForeignKeyToSqlTestCase.
       test_drop_foreign_key): Correct column specs.
     * tests/dbobject/ New test to check column RENAME.
Commits on Apr 18, 2011
  1. @jmafc

    Add support for FOREIGN KEY ON UPDATE/ON DELETE actions.

    jmafc authored
     * docs/constraint.rst: Add example map including on_update/on_delete.
     * pyrseas/dbobject/ (ForeignKey.add): Tack on actions to
       SQL statement if on_update/on_delete are present.
       (ConstraintDict.query): Retrieve confupdtype and confdeltype as
       on_update and on_delete, respectively.
       (ConstraintDict._from_catalog): Handle on_update/on_delete when
       constructing a ForeignKey.  (ConstraintDict.from_map): Handle and
       validate on_update/on_delete actions in input.
     * tests/dbobject/ Add tests to check mapping and
       SQL generation of ON UPDATE/ON DELETE actions.
Commits on Apr 15, 2011
  1. @jmafc

    Add support for comments on schemas, tables and columns.

    jmafc authored
      * docs/column.rst docs/dbobject.rst, docs/schema.rst: Add new
      * pyrseas/dbobject/ (DbObject.__init__): Only discard
        non-key attributes without a value.  (DbSchemaObject.comment): New
        method to return a COMMENT.
      * pyrseas/dbobject/ (Column.comment): New method.
        (ColumnDict.query): Add description.
      * pyrseas/dbobject/ (Schema._to_map): Add description if
        present.  (Schema.comment): New method to return a COMMENT.
        (Schema.create): Return comment if self has description.
        (Schema.diff_map): New method, mainly to deal with descriptions.
        (SchemaDict.query): Add description.  (SchemaDict.from_map): Add
        description if present.  (SchemaDict.diff_map): Add comparison of
        input and db maps.
      * pyrseas/dbobject/ (Table.create): Return comment if self
        has description and do the same for each column.
        (Table.diff_map): Deal with descriptions.  (ClassDict.query): Add
        description.  (ClassDict.from_map): Disregard description at
        schema level, handle description at table level.
      * tests/dbobject/ Don't validate public schema,
        except where absolutely necessary (to avoid its comments). Use
        new_std_map to create input maps.
      * tests/dbobject/ Use new_std_map to create input
      * tests/dbobject/ Don't validate public schema (to
        avoid its comments). New test cases for comments on schemas.
      * tests/dbobject/ Use new_std_map to create input
      * tests/dbobject/ Use new_std_map to create input
        maps. New test cases for comments on tables and columns.
      * tests/dbobject/ New function new_std_map.
Commits on Apr 7, 2011
  1. @jmafc
Commits on Apr 6, 2011
  1. @jmafc
Commits on Apr 5, 2011
  1. @jmafc

    Initial submission.

    jmafc authored
    Base versions of dbtoyaml and yamltodb handle schemas, sequences,
    tables, columns, check constraints, primary keys, foreign keys, unique
    constraints and indexes.
Something went wrong with that request. Please try again.