Commits on Oct 26, 2012
  1. @jmafc

    Update release files for 0.6.0.

    jmafc committed Oct 26, 2012
Commits on Oct 23, 2012
  1. @jmafc
Commits on Oct 19, 2012
  1. @jmafc
Commits on Oct 17, 2012
  1. @jmafc

    Additional correction of parsing of pg_get_expr index expressions.

     * pyrseas/dbobject/index.py (IndexDict._from_catalog): Handle
       expressions not involving function calls, but rather operators
       (which expressions must be parentthesized).
     * tests/dbobject/test_index.py
       (IndexTo{Map,Sql}TestCase.test_index_mixed): Add index using the
       concatenation operator.
    jmafc committed Oct 17, 2012
Commits on Oct 16, 2012
  1. @jmafc

    Correct parsing of pg_get_expr index expressions. Fixes #44.

     * pyrseas/dbobject/index.py (split_exprs): New helper function to
       implement the parsing.  (Index._from_catalog): Replace existing
       code by call to split_exprs.
     * tests/dbobject/test_index.py
       (IndexToMapTestCase.test_index_function_multi): Rename to
       test_index_function_complex and replace existing indexes by more
       complex versions, using substring/position and extract from date.
    jmafc committed Oct 16, 2012
Commits on Oct 9, 2012
  1. @jmafc

    Schema-qualify composite types when dropping/renaming attributes. Fixes

    #47.
    
     * pyrseas/dbobject/column.py (Column.to_map): Delete _type if
       present.  (Column.{drop, rename}: Use _type.qualname() to determine
       the name to output.
     * pyrseas/dbobject/dbtype.py (TypeDict.link_refs): Link each
       attribute of a composite type to its "parent" object.
     * tests/dbobject/test_type.py: New test to verify correction.
    jmafc committed Oct 9, 2012
Commits on Oct 8, 2012
  1. @jmafc

    Support create function SET configuration_parameter. Fixes #46.

     * pyrseas/dbobject/function.py (Function.create): Add SET clause if
       configuration is present.  (ProcDict.query): Fetch
       pg_proc.proconfig.
     * tests/dbobject/test_function.py: Two tests to verify new functionality.
    jmafc committed Oct 8, 2012
Commits on Oct 5, 2012
  1. @jmafc

    Support PG 9.1 unlogged tables. Fixes #45.

     * pyrseas/dbobject/table.py (Table.to_map). Add unlogged to
       recognized attribute list.  (Table.create): Generate UNLOGGED
       modifier if necessary.  (ClassDict.query): Fetch relpersistence and
       move existing query to QUERY_PRE91.  (ClassDict._from_catalog):
       Translate persistence == 'u' to unlogged = True.
       (ClassDict.from_map): Add unlogged to recognized attribute list.
     * tests/dbobject/test_table.py: Two tests to verify new functionality.
    jmafc committed Oct 5, 2012
Commits on Oct 3, 2012
  1. @jmafc

    In pyrseas/testutils.py, use getpass.getuser instead of os.getenv("US…

    …ER").
    
      This makes the tests portable to Windows.
    jmafc committed Oct 3, 2012
Commits on Sep 5, 2012
  1. @jmafc
Commits on Aug 31, 2012
  1. @jmafc

    Changes resulting from or needed for testing against PostgresSQL 9.2rc1.

     * pyrseas/dbobject/operator.py (OperatorDict.query): Remove
       unnecessary casts to regproc.
     * tests/dbobject/test_operator.py (OperatorToMapTestCase): Change to
       reflect 9.2 output of querying pg_operator.
     * tests/dbobject/test_tablespace.py: Add comment explaining
       requirement for test tablespaces.
     * tox.ini: Add pg92 test environments.
    jmafc committed Aug 31, 2012
Commits on Aug 29, 2012
  1. @jmafc
Commits on Aug 28, 2012
  1. @jmafc

    Allow unit tests to be run by non-superusers.

     * pyrseas/testutils.py (PostgresDb.clear): Use pg_user_mappings view
       instead of pg_user_mapping.  (PostgresDb.is_superuser): New method.
       (DatabaseToMapTestCase.to_map, InputMapToSqlTestCase.to_sql): Add
       superuser flag and skip test if current user is not a superuser.
     * tests/dbobject/{test_cast.py, test_extension.py, test_foreign.py,
       test_function.py, test_language.py, test_operclass.py,
       test_operfamily.py, test_privs.py, test_textsearch.py,
       test_type.py}: Add superuser flag to tests require superuser
       privileges.
    jmafc committed Aug 28, 2012
Commits on Aug 22, 2012
  1. @jmafc

    Add support for changing column-level privileges.

     * docs/column.rst: Add automethod for new methods.
     * pyrseas/dbobject/column.py (Column.add_privs): New method to add
       GRANTs for columns.  (Column.diff_privileges): New method to
       generate GRANT/REVOKE statements at the column level.
       (ColumnDict.from_map): Map column-level privileges.
     * pyrseas/dbobject/privileges.py ({_expand_priv_lists, add_grant,
       add_revoke, diff_privs}): Add sub-object argument to handle column
       names.
     * pyrseas/dbobject/table.py (Table.create): Remove grantable
       decorator; add to handle both table and column-level privileges.
       (Table.diff_map): Process column-level privileges.
       (TableDict.from_map): Map owner information before handling
       columns.
     * tests/dbobject/test_privs.py: Add tests for verifying new support.
    jmafc committed Aug 22, 2012
Commits on Aug 17, 2012
  1. @jmafc

    Add support for testing with tox.

    jmafc committed Aug 17, 2012
Commits on Aug 16, 2012
  1. @jmafc

    Update release files for 0.6.0beta

    jmafc committed Aug 16, 2012
Commits on Aug 15, 2012
  1. @jmafc

    Add support for changing privileges on tables, functions and other ob…

    …jects.
    
     * pyrseas/dbobject/__init__.py (DbObject.diff_privileges): New method
       to compare privileges between current and input objects.
     * pyrseas/dbobject/function.py (Function.diff_map): Call
       diff_privileges.
     * pyrseas/dbobject/privileges.py (_expand_priv_lists): New function
       abstracted from code in add_grant.  (add_grant): Move parts to
       _expand_priv_lists.  (add_revoke): New function to return REVOKEs.
       (diff_privs): New function to compare privileges in detail.
     * pyrseas/dbobject/schema.py: Pep8 edit.
     * pyrseas/dbobject/table.py ({Sequence, Table, View}.diff_map): Call
       diff_privileges.
     * pyrseas/testutils.py (InputMapToSqlTestCase.std_map): Update with
       owner and privilege information for the public schema.
     * tests/dbobject/test_privs.py: Add tests for verifying new support.
    jmafc committed Aug 15, 2012
Commits on Aug 10, 2012
  1. @jmafc

    Refactor SchemaDict.link_refs.

     * pyrseas/dbobject/schema.py (SchemaDict.link_refs): Add nested function
       link_one and use it to simplify the various loops in this method.
    jmafc committed Aug 10, 2012
Commits on Aug 9, 2012
  1. @jmafc

    Refactor SchemaDict.from_map.

     * pyrseas/dbobject/schema.py (PREFIXES): Dictionary of object key
       prefixes and corresponding object types.  (SCHOBJS1, SCHOBJS2):
       Lists of schema objects.  (SchemaDict.from_map): Replace individual
       dictionaries by a dictionary of dictionaries, simplify loop that
       examines each input key and convert sequential calls to subsidiary
       objects into two loops.
    jmafc committed Aug 9, 2012
Commits on Aug 8, 2012
  1. @jmafc

    Basic support for GRANTing privileges on schemas, functions and other…

    … objects.
    
     * pyrseas/dbobject/foreign.py ({ForeignDataWrapper,
       ForeignServer}.allprivs): New property methods.
       ({ForeignDataWrapper, ForeignServer, ForeignTable}.create): Add
       grantable decorator.  ({ForeignDataWrapperDict,ForeignServerDict,
       ForeignTableDict}.from_map): Map input privileges and refactor
       other attributes.
     * pyrseas/dbobject/function.py (Proc.allprivs): New property method.
       ({Function, Aggregate}.create): Add grantable decorator.
       (ProcDict.from_map) Map input privileges and refactor other
       attributes.
     * pyrseas/dbobject/privileges.py (privileges_to_map, add_grant): Only
       convert privilege list to ALL if more than one privilege is
       involved.  (add_grant): Use privobjtype if present.
     * pyrseas/dbobject/schema.py (Schema.allprivs): New property method.
       (Schema.create): Add grantable decorator.  (SchemaDict.from_map)
       Map input privileges and refactor oldname and description.
     * pyrseas/dbobject/table.py (DbClass, Sequence): Remove privobjtype
       attribute.  (View): Add privobjtype attribute.
     * tests/dbobject/__init__.py: Add test_privs.
     * tests/dbobject/test_privs.py: Add tests to verify new
       functionality.
    jmafc committed Aug 8, 2012
Commits on Aug 7, 2012
  1. @jmafc

    Basic support for GRANTing privileges on created tables/sequences/views.

     * pyrseas/dbobject/__init__.py: Move PRIVCODES and most of the code
       in DbObject.map_privs to privileges_to_map in privileges.py.
       (grantable): New decorator.
     * pyrseas/dbobject/privileges.py: New module to implement
       privilege-related functions.
     * pyrseas/dbobject/schema.py: pep8 edit.
     * pyrseas/dbobject/table.py ({Sequence, Table, View}.allprivs):
       Convert from data to property method.  ({Sequence, Table,
       View}.create): Add grantable decorator.  (ClassDict.from_map):
       Process privileges if present in input dict.
     * tests/dbobject/test_privs.py: Add tests to verify new
       functionality.
    jmafc committed Aug 7, 2012
Commits on Jul 31, 2012
  1. @jmafc

    Support for displaying access privileges on table columns.

     * pyrseas/dbobject/__init__.py (DbObject.map_privs): Check that
       object has an owner before formatting grantor information.
     * pyrseas/dbobject/column.py (Column.to_map): Add no_privs argument
       and pass it downstream.  (ColumnDict.query): Fetch privileges.
       (ColumnDict._from_catalog): Convert the privileges to a list.
     * pyrseas/dbobject/dbtype.py (Composite.to_map): Pass False to
       Column.to_map.
     * pyrseas/dbobject/foreign.py (ForeignTable.to_map): Pass no_privs to
       Column.to_map.
     * pyrseas/dbobject/table.py (Table.to_map): Pass no_privs to
       Column.to_map.
     * tests/dbobject/test_privs.py: New test to verify functionality.
    jmafc committed Jul 31, 2012
  2. @jmafc

    Basic support for displaying access privileges by dbtoyaml.

     * docs/dbobject.rst: Add automethod for DbObject.map_privs.
     * docs/dbtoyaml.rstAdd -x/--no-privileges option.  Update default
       output and descriptive text.
     * pyrseas/database.py(Database.to_map): Add no_owner parameter and
       pass it downstream.  Refactor pg_catalog special case.
     * pyrseas/dbobject/__init__.py (DbObject._base_map): Add no_privs
       argument and process accordingly.  (DbObject.to_map): Add no_privs
       arguments and pass it downstream.  (DbObject.map_privs): New method
       to format privileges.  (DbObjectDict._from_catalog): Convert the
       privileges to a list.
     * pyrseas/dbobject/foreign.py ({ForeignDataWrapper,
       ForeignServer}.to_map): Add no_privs argument and pass it
       downstream.  ({ForeignDataWrapperDict, ForeignServerDict,
       ForeignTableDict}.query): Fetch privileges.  ({ForeignWrapperDict,
       ForeignServerDict}.to_map): Add no_privs argument and pass it
       downstream.  (ForeignTable.to_map): Add no_privs argument and
       process accordingly.  (ForeignTableDict._from_catalog): Convert the
       privileges to a list.
     * pyrseas/dbobject/function.py (Function.to_map): Add no_privs
       argument and process accordingly.  (Aggregate.to_map): Add no_privs
       argument and pass it downstream.  (ProcDict.query): Fetch
       privileges.  (ProcDict._from_catalog): Convert the privileges to a
       list.
     * pyrseas/dbobject/language.py (Language.to_map): Add no_privs
       argument and pass it downstream.  (LanguageDict.query): Fetch
       privileges.  (LanguageDict.to_map): Add no_privs argument and pass
       it downstream.
     * pyrseas/dbobject/schema.py (Schema.to_map): Add no_privs argument
       and pass it downstream.  (SchemaDict.query): Fetch privileges.
       (SchemaDict.to_map): Add no_privs argument and pass it downstream.
     * pyrseas/dbobject/table.py ({Sequence, Table}.to_map); Add no privs
       argument and process accordingly.  (ClassDict.query): Fetch
       privileges.  (ClassDict._from_catalog): Convert the privileges to a
       list.
     * pyrseas/dbtoyaml.py: Add --no-privileges argument and pass it to
       to_map.
     * pyrseas/testutils.py (DatabaseToMapTestCase.to_map): Add no_privs,
       default True, and pass it down to Database.to_map.
     * tests/dbobject/test_privs.py: New tests to verify functionality.
    jmafc committed Jul 30, 2012
Commits on Jul 30, 2012
  1. @jmafc
Commits on Jul 24, 2012
  1. @jmafc
Commits on Jul 23, 2012
  1. @jmafc
  2. @jmafc

    Add support for ALTER object OWNER TO statements when the owner changes.

     * docs/type.rst: Correct automethod diff_map for Composite and
       Domain.
     * pyrseas/dbobject/__init__.py (DbObject.alter_owner): Add owner
       argument and use it in the statement if present.
       (DbObject.diff_map): Process changes to owners.
     * pyrseas/dbobject/dbtype.py (DbType.diff_map): Remove since it's
       covered by the parent's method.  (Composite.diff_map): Call
       alter_owner if necessary.
     * pyrseas/dbobject/foreign.py ({ForeignDataWrapper, ForeignServer,
       ForeignTable}.diff_map): Call alter_owner as needed.
     * pyrseas/dbobject/function.py (Function.diff_map): Call owner if
       necessary.
     * pyrseas/dbobject/table.py ({Sequence, Table, View}.diff_map): Call
       alter_owner as needed.
     * tests/dbobject/test_owner.py: New test to verify ALTER object OWNER
       to when table owner changes.
    jmafc committed Jul 23, 2012
Commits on Jul 19, 2012
  1. @jmafc

    Add support for generating ALTER object OWNER TO statements.

     * docs/dbobject.rst: Add automethod for alter_owner.
     * pyrseas/dbobject/__init__.py (ownable): New decorator.
       (DbObject.alter_owner): New function to add ALTER object OWNER
       statements.
     * pyrseas/dbobject/{collation, conversion, dbtype, foreign, function,
       language, operator, operclass, operfamily, schema, table,
       textsearch.py}.py: Add ownable decorator to various create methods.
     * pyrseas/dbobject/table.py (Table.create): Call alter_owner.
       (ClassDict.from_map): Process 'owner' attribute if present,
       refactor attribute processing.
     * pyrseas/dbobject/trigger.py (Trigger.create): Remove unused
       variable.
     * tests/dbobject/test_owner.py: New tests for verify ALTER object
       OWNER to.
    jmafc committed Jul 19, 2012
Commits on Jul 18, 2012
  1. @jmafc

    Add commentable decorator for various create/add methods.

     * pyrseas/dbobject/__init__.py (commentable): New decorator.
     * pyrseas/dbobject/{cast.py, collation.py, constraint.py,
       conversion.py, dbtype.py, extension.py, foreign.py, function.py,
       index.py, operator.py, operclass.py, operfamily.py, rule.py,
       schema.py, table.py, textsearch.py, trigger.py}: Change most create
       or add methods to use the commentable decorator.
    jmafc committed Jul 18, 2012
Commits on Jul 17, 2012
  1. @jmafc

    Add support for showing object owner in the output of dbtoyaml.

     * docs/dbtoyaml.rst: Add -O/--no-owner option.  Update default
       output.
     * pyrseas/database.py (Database.to_map): Add no_owner parameter and
       pass it downstream.
     * pyrseas/dbobject/__init__.py (DbObject._base_map): Add no_owner and
       exclude owner if present accordingly.  (DbObject.to_map): Add
       no_owner and pass it to _base_map.
     * pyrseas/dbobject/collation.py (CollationDict.query): Fetch rolname.
     * pyrseas/dbobject/dbtype.py (BaseType.to_map): Add no_owner and pass
       it to _base_map.  (Composite.to_map): Add no_owner and process
       accordingly.  (Domain.to_map): Add no_owner and pass it to
       _base_map.  (TypeDict.query): Fetch rolname.
     * pyrseas/dbobject/extension.py (ExtensionDict.query): Fetch rolname.
       (TypeDict.to_map): Add no_owner and pass it downstream.
     * pyrseas/dbobject/foreign.py (ForeignDataWrapper.to_map):: Add
       no_owner and pass it to _base_map/to_map.
       (ForeignDataWrapperDict.{query, QUERY_PRE91}): Fetch rolname.
       (ForeignDataWrapperDict.to_map): Add no_owner and pass it
       downstream.  (ForeignServer.to_map): Add no_owner and pass it to
       _base_map.  (ForeignServerDict.query): Fetch rolname.
       (ForeignTable.to_map): Add no_owner and process accordingly.
       (ForeignTableDict.query): Fetch rolname.
     * pyrseas/dbobject/function.py (Function.to_map): Add no_owner and
       pass it to _base_map.  (Aggregate.to_map): Add no_owner and pass it
       to _base_map.  (ProcDict.query): Fetch rolname.
     * pyrseas/dbobject/language.py (Language.to_map): Add no_owner and
       pass it to _base_map.  (LanguageDict.query): Fetch rolname.
       (LanguageDict.to_map): Add no_owner and pass it downstream.
     * pyrseas/dbobject/operator.py (OperatorDict.query): Fetch rolname.
     * pyrseas/dbobject/operclass.py (OperatorClass.to_map): Add no_owner
       and pass it to _base_map.  (OperatorClassDict.query): Fetch
       rolname.
     * pyrseas/dbobject/operfamily.py (OperatorFamilyDict.query): Fetch
       rolname.
     * pyrseas/dbobject/schema.py (Schema.to_map): Add no_owner and pass
       it downstream.  (SchemaDict.query): Fetch rolname.
       (SchemaDict.to_map): Add no_owner and pass it downstream.
     * pyrseas/dbobject/table.py (Sequence.to_map): Add no_owner and
       process accordingly.  (Table.to_map): Add no_owner and process
       accordingly.  (ClassDict.query): Fetch rolname.
     * pyrseas/dbobject/textsearch.py (TSConfiguration.to_map): Add
       no_owner and pass it to _base_map.  (TSConfigurationDict.query):
       Fetch rolname.  (TSDictionaryDict.query): Fetch rolname.
     * pyrseas/dbtoyaml.py: Add --no-owner argument and pass it to to_map.
     * pyrseas/testutils.py (DatabaseToMapTestCase.to_map): Add no_owner,
       default True, and pass it down to Database.to_map.
     * tests/dbobject/__init__.py: Add test_owner.
     * tests/dbobject/test_owner.py: New module to test object ownership.
    jmafc committed Jul 17, 2012
Commits on Jul 12, 2012
  1. @jmafc

    Add support for ALTER TYPE DROP/RENAME ATTRIBUTE and attribute COLLATE.

     * pyrseas/dbobject/column.py (Column.rename): Handle TYPE attributes
       as well as COLUMNs.
     * pyrseas/dbobject/dbtype.py (Composite.create): Add attributes by
       calling Column.add.
     * tests/dbobject/test_collation.py: New test for CREATE TYPE with
       COLLATE on attribute.
     * tests/dbobject/test_type.py: New tests for ALTER TYPE DROP and
       RENAME ATTRIBUTE.
    jmafc committed Jul 12, 2012
Commits on Jul 11, 2012
  1. @jmafc

    Add support for ALTER TYPE ADD ATTRIBUTE. Also change attribute format.

     * docs/column.rst: Indicate Column class also covers composite type
       attributes.
     * pyrseas/dbobject/column.py (Column.to_map): Only delete _table if
       present.
     * pyrseas/dbobject/dbtype.py (Composite.to_map): Delegate attribute
       mapping to column/attribute class.  (Composite.diff_map): New
       method to compare types and their attributes.
     * pyrseas/dbobject/table.py (Table.to_map): Simplify for loop.
     * tests/dbobject/test_type.py: New test to verify support. Change
       existing tests to reflect new format.
    jmafc committed Jul 11, 2012
Commits on Jul 10, 2012
  1. @jmafc

    Pep8-suggested changes.

    jmafc committed Jul 10, 2012
  2. @jmafc

    Don't add/drop child columns when added/dropped to/from parent. Fixes #…

    …33.
    
     * pyrseas/dbobject/column.py (ColumnDict.diff_map): Don't drop if
       column has inherited attribute.
     * pyrseas/dbobject/table.py (Table.diff_map): Don't add column if it
       has an inherited attribute.  Some pep8-suggested changes elsewhere.
     * tests/dbobject/test_column.py: Two new tests to verify fix.
    jmafc committed Jul 10, 2012
Commits on Jul 9, 2012
  1. @jmafc