Permalink
Commits on Jun 7, 2011
  1. Update release files for 0.2.1.

    jmafc committed Jun 7, 2011
  2. Update NEWS for release 0.2.1.

    jmafc committed Jun 7, 2011
  3. Deal with dropped columns by retrieving attisdropped. Fixes issue #2.

    jmafc committed Jun 7, 2011
     * pyrseas/dbobject/column.py (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.py (Table.to_map): Skip columns that have
       been dropped.
     * tests/dbobject/test_constraint.py (ForeignKeyToMapTestCase): Two
       new test cases, for multiple foreign keys and foreign keys where
       columns have been dropped.
Commits on May 19, 2011
  1. Update NEWS for release 0.2.0.

    jmafc committed May 19, 2011
  2. Changes for release 0.2.0 and distribution via PGXN.

    jmafc committed May 19, 2011
     * .gitignore: Add 'build' subdirectory.
     * MANIFEST.in: Include Makefile and META.json.
     * META.json: New file required by PGXN.
     * Makefile: New file needed by PGXN.
     * docs/conf.py: Change version/release identifiers.
     * docs/index.rst: Add install.rst.
     * docs/install.rst: New file documenting installation procedures.
     * setup.py: Change version.
Commits on May 17, 2011
  1. Add support for testing against multiple PostgreSQL versions.

    jmafc committed May 17, 2011
     * docs/dbconn.rst: Document new version property.
     * pyrseas/database.py (Database.diff_map): Pass version as argument
       to languagues.diff_map.
     * pyrseas/dbconn.py (DbConnection): Add version as property, fetch on
       connect.
     * pyrseas/dbobject/language.py (LanguageDict.diff_map): Add dbversion
       parameter and use it to special case plpgsql.
       (LanguageDict._drop): Fix leftover code pasted from SchemaDict.
     * tests/dbobject/test_constraint.py
       (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/utils.py (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. Add basic support for functions.

    jmafc committed May 13, 2011
     * docs/dbobject.rst: Add new automethods and remove refactored
       automethod.
     * docs/function.rst: New file to document functions.
     * docs/index.rst: Add function.rst.
     * pyrseas/database.py (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/__init__.py (DbObject.{identifier,comment,drop}):
       New identifier method for use by comment and drop.
       (DbObject.diff_description): Refactored from table.py.
       (DbSchemaObject.identifier): New method override.
       (DbSchemaObject.comment): Removed.  (DbSchemaObject.drop): Updated
       to use new identifier method.
     * pyrseas/dbobject/function.py: New module for added functionality.
     * pyrseas/dbobject/schema.py (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/table.py (DbClass.diff_description): Removed.
     * tests/dbobject/__init__.py: Invoke function tests.
     * tests/dbobject/test_function.py: New test module.
     * tests/dbobject/utils.py (PostgresDb.clear): Add code to drop
       existing functions.
Commits on May 11, 2011
  1. Add basic support for procedural languages.

    jmafc committed May 11, 2011
     * 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.py (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/__init__.py: Refactor extern_key from
       DbSchemaObject (and Schema) to DbObject. Refactor comment, drop and
       rename methods from Schema into DbObject.
     * pyrseas/dbobject/language.py: New module for procedural languages.
     * pyrseas/dbobject/schema.py (Schema): Remove extern_key, comment,
       drop and rename methods.
     * tests/dbobject/__init__.py: Invoke language tests.
     * tests/dbobject/test_language.py: New test module.
Commits on May 6, 2011
  1. Add support for inherited tables.

    jmafc committed May 6, 2011
     * pyrseas/dbobject/__init__.py (split_schema_table): New utility
       function split schema-qualified names.  (DbSchemaObject.unqualify):
       Use new function.
     * pyrseas/dbobject/column.py (Column.to_map): Map inherited columns.
       (ColumnDict.query): Retrieve attinhcount as 'inherited'.
     * pyrseas/dbobject/constraint.py (ConstraintDict._from_catalog):
       Recall code by call to split_schema_table.
     * pyrseas/dbobject/table.py (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/test_table.py:  Add tests for inherited tables.
     * tests/dbobject/utils.py (PostgresDb.clear): Use IF EXISTS for
       dropping tables.
Commits on Apr 29, 2011
  1. Add support for views.

    jmafc committed Apr 29, 2011
     * 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.py (Schema.to_map, SchemaDict.link_refs):
       Add code for dealing with views.
     * pyrseas/dbobject/table.py (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/__init__.py: Call test_view suite.
     * tests/dbobject/test_schema.py (SchemaToSqlTestCase.
       test_drop_schema): Late fix to remove CASCADE.
     * tests/dbobject/test_sequence.py: Correct header comment.
     * tests/dbobject/test_view.py: New module to test new functionality.
     * tests/dbobject/utils.py (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. Correct dropping of PRIMARY KEYs that are still being referenced.

    jmafc committed Apr 26, 2011
     * pyrseas/dbobject/table.py (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. Possibly temporary solution to dropping schemas.

    jmafc committed Apr 22, 2011
     * pyrseas/database.py (Database.diff_map): Call new SchemaDict._drop
       before returning.
     * pyrseas/dbobject/schema.py (Schema.drop): Don't use CASCADE.
       (SchemaDict.diff_map): Only mark schemas to be dropped.
       (SchemaDict._drop): New method to actually DROP the schemas.
Commits on Apr 21, 2011
Commits on Apr 20, 2011
  1. Add support for RENAME COLUMN.

    jmafc committed Apr 20, 2011
     * docs/column.rst: Add automethod Column.rename.
     * pyrseas/dbobject/__init__.py (DbSchemaObject.rename): Document
       missing parameter newname.
     * pyrseas/dbobject/column.py (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.py (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/test_constraint.py (ForeignKeyToSqlTestCase.
       test_drop_foreign_key): Correct column specs.
     * tests/dbobject/test_table.py: New test to check column RENAME.
Commits on Apr 18, 2011
  1. Add support for FOREIGN KEY ON UPDATE/ON DELETE actions.

    jmafc committed Apr 18, 2011
     * docs/constraint.rst: Add example map including on_update/on_delete.
     * pyrseas/dbobject/constraint.py (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/test_constraint.py: Add tests to check mapping and
       SQL generation of ON UPDATE/ON DELETE actions.
Commits on Apr 15, 2011
  1. Add support for comments on schemas, tables and columns.

    jmafc committed Apr 15, 2011
      * docs/column.rst docs/dbobject.rst, docs/schema.rst: Add new
        automethods.
      * pyrseas/dbobject/__init__.py (DbObject.__init__): Only discard
        non-key attributes without a value.  (DbSchemaObject.comment): New
        method to return a COMMENT.
      * pyrseas/dbobject/column.py (Column.comment): New method.
        (ColumnDict.query): Add description.
      * pyrseas/dbobject/schema.py (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.py (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/test_constraints.py: Don't validate public schema,
        except where absolutely necessary (to avoid its comments). Use
        new_std_map to create input maps.
      * tests/dbobject/test_index.py: Use new_std_map to create input
        maps.
      * tests/dbobject/test_schema.py: Don't validate public schema (to
        avoid its comments). New test cases for comments on schemas.
      * tests/dbobject/test_sequence.py: Use new_std_map to create input
        maps.
      * tests/dbobject/test_table.py: Use new_std_map to create input
        maps. New test cases for comments on tables and columns.
      * tests/dbobject/utils.py: New function new_std_map.
Commits on Apr 7, 2011
Commits on Apr 6, 2011
Commits on Apr 5, 2011
  1. Initial submission.

    jmafc committed Apr 5, 2011
    Base versions of dbtoyaml and yamltodb handle schemas, sequences,
    tables, columns, check constraints, primary keys, foreign keys, unique
    constraints and indexes.