Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Commits on Oct 27, 2011
  1. @jmafc

    Update release files for 0.4.1.

    jmafc authored
Commits on Oct 24, 2011
  1. @jmafc

    Second try fixing issue #8 (column dropping/adding out of order).

    jmafc authored
     * pyrseas/dbobject/table.py (Table.diff_map): Calculate number of
       columns present excluding dropped columns.  For columns out of
       order, add them if not in list of existing columns.
     * tests/dbobject/__init__.py: Invoke column tests.
     * tests/dbobject/test_column.py: New tests for dropping and adding
       columns, plus move other colum tests from test_table.py.
     * tests/dbobject/test_table.py: Move columns tests to new module.
Commits on Oct 21, 2011
  1. @jmafc

    Rework manner of creating standard input maps for unit tests.

    jmafc authored
     * tests/dbobject/utils.py (new_std_map): Remove.
       (PostgresDb.process_map): Delete code to add description for
       PL/pgSQL.  (PyrseasTestCase.std_map): New method to replace
       new_std_map, which allows different maps based on PG version.
     * tests/dbobject/{test_cast.py, test_constraint.py,
       test_conversion.py, test_domain.py, test_function.py,
       test_index.py, test_language.py, test_operator.py,
       test_operclass.py, test_operfamily.py, test_rule.py,
       test_sequence.py, test_table.py, test_trigger.py, test_type.py,
       test_view.py}: Replace new_std_map calls by self.std_map.
  2. @jmafc
Commits on Oct 18, 2011
  1. @jmafc

    Add columns that may be out of order. Fixes issue #8.

    jmafc authored
     * pyrseas/dbobject/column.py (ColumnDict.diff_map): Don't attempt to
       drop columns that have already been dropped in the catalogs (caused
       innocuous semicolons on output).
     * pyrseas/dbobject/table.py (Table.diff_map): Examine existing
       columns and generate ADD COLUMN statements if not present in the
       input map.
Commits on Oct 17, 2011
  1. @jmafc
  2. @jmafc

    Fix generation of COMMENTs which have single quotes in the text.

    jmafc authored
     * pyrseas/dbobject/__init__.py (DbObject._comment_text): Replace
       single quotes by two single quotes.
     * tests/dbobject/test_table.py: Two new test cases to verify mapping
       and SQL generation of COMMENTs with single or double quotes.
Commits on Oct 11, 2011
  1. @jmafc

    Fix queries to correctly exclude internal schemas.

    jmafc authored
     * dbobject/column.py (ColumnDict.query): Exclude pg_catalog and
       information_schema.
     * dbobject/constraint.py (ConstraintDict.query): Exclude pg_catalog
       and information_schema.
     * dbobject/index.py (IndexDict.query): Exclude pg_catalog and
       information_schema.
     * dbobject/schema.py (SchemaDict.query): Exclude information_schema,
       pg_catalog, pg_toast, pg_temp_1 and pg_toast_temp_1.
     * dbobject/table.py (ClassDict.query): Exclude pg_catalog and
       information_schema.
  2. @jmafc

    Add COMMIT after SET search_path to make it persist.

    jmafc authored
     * pyrseas/dbconn.py (DbConnection.connect): Add self.conn.commit.
     * pyrseas/dbobject/constraint.py (ForeignKey.to_map): Use refsch
       after assignment.
Commits on Sep 27, 2011
  1. @jmafc

    Update release files for 0.4.0.

    jmafc authored
  2. @jmafc

    Change queries to use obj/col_description instead of using pg_descrip…

    jmafc authored
    …tion.
    
     * docs/schema.rst: Remove Schema.diff_map automethod.
     * pyrseas/dbobject/{cast.py, column.py, conversion.py, dbtype.py,
       function.py, language.py, operator.py, operclass.py, operfamily.py,
       rule.py, schema.py, table.py, trigger.py}: Replace join to
       pg_description by call to obj_description (or col_description for
       column.py).
Commits on Sep 24, 2011
  1. @jmafc

    Link constraints back to their table and remove Constraint._qualtable.

    jmafc authored
     * pyrseas/dbobject/constraint.py (Constraint._qualtable): Remove.
       (Constraint.add): Use self._table instead of instantiating a
       DbSchemaObject.  (Constraint.{drop,comment}): Use
       self._table.qualname instead of _qualtable.
       (CheckConstraint.to_map): Delete _table if present.
       (CheckConstraint.add): Use self._table.
       ({PrimaryKey,ForeignKey,UniqueConstraint}.to_map): Delete
       _table. (ForeignKey.add): Use self._table.
     * pyrseas/dbobject/table.py (ClassDict.link_refs): Link table back to
       each constraint.
  2. @jmafc
Commits on Sep 23, 2011
  1. @jmafc

    Remove redundant diff_map methods. Add DbObject._comment_text.

    jmafc authored
     * pyrseas/dbobject/__init__.py (DbObject.comment): Move code to
       _comment_text to simplify override methods.
     * pyrseas/dbobject/column.py (Column.comment): Use _comment_text.
     * pyrseas/dbobject/constraint.py (Constraint.comment): Use
       _comment_text.
     * pyrseas/dbobject/{cast.py, conversion.py, function.py, language.py,
       operator.py, rule.py, trigger.py}: Remove diff_map as redundant.
  2. @jmafc

    Enhance documentation of DbObject. Remove redundant to_map methods.

    jmafc authored
     * docs/conversion.rst: Remove to_map automethod.
     * docs/dbobject.rst: Improve documentation of DbObject.
     * docs/operator.rst: Remove to_map automethod.
     * docs/table.rst: Remove to_map automethod on View.
     * docs/type.rst: Remove to_map automethod on Enum.
     * pyrseas/dbobject/__init__.py: Expand or add docstrings for various
       methods and attributes. (DbObject.{_base_map,to_map}): New method
       to simplify implementation of to_map.
     * pyrseas/dbobject/cast.py (Cast.extern_key): Use lowercase 'as' for
       consistency. (Cast.to_map): Use _base_map.
     * pyrseas/dbobject/column.py (Column.to_map): Use _base_map.
     * pyrseas/dbobject/constraint.py ({CheckConstraint,PrimaryKey,
       ForeignKey,UniqueConstraint}.to_map): Use _base_map.
     * pyrseas/dbobject/conversion.py (Conversion.to_map): Remove as
       redundant.
     * pyrseas/dbobject/dbtype.py ({BaseType,Domain}.to_map): Use
       _base_map. (Enum.to_map): Remove as redundant.
     * pyrseas/dbobject/function.py ({Function,Aggregate}.to_map): Use
       _base_map.
     * pyrseas/dbobject/index.py (Index.to_map): Use _base_map.
     * pyrseas/dbobject/language.py (Language.to_map): Use
       _base_map. Eliminate redundant description code.
     * pyrseas/dbobject/operator.py (Operator.to_map): Remove as
       redundant.
     * pyrseas/dbobject/operclass.py (OperatorClass.to_map): Use
       _base_map.
     * pyrseas/dbobject/operfamily.py: Indentation.
     * pyrseas/dbobject/rule.py (Rule.to_map): Use _base_map.
     * pyrseas/dbobject/table.py (View.to_map): Remove as redundant.
     * pyrseas/dbobject/trigger.py (Trigger.to_map): Use _base_map.
     * tests/dbobject/test_cast.py: Use 'as' instead of 'AS' in external
       maps.
     * tests/dbobject/test_language.py: Spacing.
Commits on Sep 21, 2011
  1. @jmafc

    Add support for comments on views, sequences, indexes and constraints.

    jmafc authored
     * docs/constraint.rst: Add automethod for Constraint.comment.
     * pyrseas/dbobject/constraint.py: Add Constraint.comment and support
       for mapping and creating comments.
     * pyrseas/dbobject/index.py: Add support for mapping and creating
       comments.
     * pyrseas/dbobject/language.py (Language.diff_map): Replace body by
       call to generic implementation.
     * pyrseas/dbobject/table.py: Add support for mapping and creating
       comments on sequences and views.
     * tests/dbobject/{test_constraint.py, test_index.py,
       test_language.py, test_sequence.py, test_view.py}: Add new tests
       for comment mapping and generation.
Commits on Sep 18, 2011
  1. @jmafc
Commits on Sep 17, 2011
  1. @jmafc

    Add support for operator classes.

    jmafc authored
     * docs/index.rst: Add operclass.rst.
     * docs/operclass.rst: New page to document operator classes.
     * pyrseas/database.py: (Database.Dicts.__init__): Add dictionary for
       operator classes.  (Database.link_refs): Add operator classes
       argument to schemas.link_refs call.  (Database.diff_map): Call
       operclasses.diff_map and operclasses._drop.
     * pyrseas/dbobject/operclass.py: New module to implement operator
       classes.
     * pyrseas/dbobject/schema.py (Schema.to_map): Process operator
       classes.  (SchemaDict.from_map): Process input operator classes.
       (SchemaDict.link_refs): Add argument for operator classes.
     * tests/dbobject/__init__.py: Invoke operator class tests.
     * tests/dbobject/test_operclass.py: New test module.
     * tests/dbobject/utils.py: (PostgresDb.clear): Drop existing operator
       classes.
Commits on Sep 7, 2011
  1. @jmafc

    Add support for operator families.

    jmafc authored
     * docs/index.rst: Add operfamily.rst.
     * docs/operfamily.rst: New page to document operator families.
     * pyrseas/database.py (Database.Dicts.__init__): Add dictionary for
       operator families.  (Database.link_refs): Add operator families
       argument to schemas.link_refs call.  (Database.diff_map): Call
       operfams.diff_map and operfams._drop.
     * pyrseas/dbobject/__init__.py (DbObject.{to_map, diff_map}): New
       generic methods.
     * pyrseas/dbobject/operfamily.py: New module to implement operator
       families.
     * pyrseas/dbobject/schema.py(Schema.to_map): Process operator
       families.  (SchemaDict.from_map): Process input operator families.
       (SchemaDict.link_refs): Add argument for operator families.
     * tests/dbobject/__init__.py: Invoke operator family tests.
     * tests/dbobject/test_operfamily.py: New test module.
     * tests/dbobject/utils.py (PostgresDb.clear): Drop existing operator
       families.
Commits on Sep 1, 2011
  1. @jmafc

    Add support for base types.

    jmafc authored
     * docs/function.rst: Add Aggregate.diff_map.
     * docs/operator.rst: Add Operator.qualname.
     * docs/type.rst: Add BaseType documentation.
     * pyrseas/database.py: Add db.functions as argument to call of
       types.link_refs.
     * pyrseas/dbobject/__init__.py (split_schema_obj): Renamed from
       split_schema_table.
     * pyrseas/dbobject/constraint.py (ConstraintDict._from_catalog):
       Renamed split_schema_table to split_schema_obj.
     * pyrseas/dbobject/dbtype.py (DbType.diff_map): Moved from Domain to
       be used by all subclasses.  (BaseType): Add class to support new
       functionality.  (Composite.to_map): Output description if present.
       (TypeDict.{query,_from_catalog}): Add new attributes for base
       types.  (TypeDict.from_map): Add handling of base types,
       re-organize others.  (TypeDict.link_refs): Handle base types, add
       dbfunctions argument to link type-related functions.
       (TypeDict._drop): Special case for functions that do not get
       dropped by DROP TYPE ... CASCADE.
     * pyrseas/dbobject/function.py (Function.to_map): Add mapping of cost
       if present. (Function.create): Add basetype argument, support
       'internal' as a language, add cost if present.
       (Function.diff_map): Test for presence of 'source' attributes
       before comparing them.  (Aggregate.diff_map): Add missing method.
       (ProcDict.{query,_from_catalog}): Retrieve cost.
       (ProcDict.from_map): Use str.partition instead of str.find.
       (ProcDict._drop): Split loop into two, first for Aggregates, then
       rest, but exclude type-related functions.
     * pyrseas/dbobject/language.py (LanguageDict.from_map): Use
       str.partition instead of str.find.
     * pyrseas/dbobject/operator.py (Operator.create): Add RESTRICT and
       JOIN, generalize handling of optional clauses.
       (OperatorDict.{query,_from_catalog}): Retrieve restrict and join
       functions.  (OperatorDict.from_map): Use str.partition instead of
       str.find.
     * pyrseas/dbobject/schema.py (SchemaDict.from_map): Use str.partition
       instead of str.find.  (SchemaDict.link_refs): Add handling of base
       types.
     * pyrseas/dbobject/table.py: Rename split_schema_table to
       split_schema_obj.  (ClassDict.from_map): Use str.partition instead
       of str.find.
     * tests/dbobject/test_function.py: Add test to generate DROP
       AGGREGATE.
     * tests/dbobject/test_operator.py: Minor format change suggested by
       pep8.
     * tests/dbobject/test_type.py:  Add BaseType test cases.
     * tests/dbobject/utils.py (PostgresDb.clear): Drop types, including
       base types, before functions.
Commits on Aug 26, 2011
  1. @jmafc

    Merge branch 'r0.3'

    jmafc authored
     * pyrseas/dbobject/operator.py (Operator.qualname): Need to modify super
       implementation because operators should not be quoted.
  2. @jmafc

    Update release files for 0.3.1.

    jmafc authored
Commits on Aug 25, 2011
  1. @jmafc

    More fixes for quoting non-regular identifiers. Partial fix of issue #5.

    jmafc authored
     * pyrseas/dbobject/__init__.py (split_schema_table): If table name is
       quoted, strip the quotes.  (DbSchemaObject.set_search_path): Use
       quote_id.
     * pyrseas/dbobject/column.py (Column.set_sequence_default): Use
       quote_id.
     * pyrseas/dbobject/table.py (Sequence.add_owner): Use quote_id.
  2. @jmafc

    The 'public' schema need not exist. Workaround for issue #4.

    jmafc authored
     * pyrseas/dbconn.py (DbConnection.connect): If set search_path fails
       with public schema, try again without it.
Commits on Aug 24, 2011
  1. @jmafc

    Quote non-regular identifiers (except SQL keywords). Partial fix of i…

    jmafc authored
    …ssue #5.
    
     * pyrseas/dbobject/__init__.py (quote_id): New function to quote
       identifiers if needed.  (DbObject.identifier,
       DbSchemaObject.qualname): Use new quote_id function.
     * pyrseas/dbobject/column.py (Column.add): Use quote_id.
     * pyrseas/dbobject/constraint.py (Constraint.{key_columns,create}):
       Use quote_id.
     * pyrseas/dbobject/index.py (Index.create): Use quote_id.
     * pyrseas/dbobject/language.py (Language.create): Use quote_id.
       (LanguageDict.from_map): Replace str.split() by str.find(' ') to
       correctly separate the name.
     * pyrseas/dbobject/rule.py (Rule.{identifier,create}): Use quote_id.
     * pyrseas/dbobject/schema.py (Schema.create): Use quote_id.
       (SchemaDict.from_map): Replace str.split() by str.find(' ') to
       correctly separate the name.
     * pyrseas/dbobject/table.py (Sequence.get_attrs): Use quote_id.
     * pyrseas/dbobject/trigger.py (Trigger.{identifier,create}): Use
       quote_id.
Commits on Aug 15, 2011
  1. @jmafc
Commits on Aug 12, 2011
  1. @jmafc

    Add support for conversions.

    jmafc authored
     * docs/conversion.rst: New page to document conversions.
     * docs/index.rst: Add conversion.rst. Re-order some topics.
     * pyrseas/database.py (Database.Dicts.__init__): Add dictionary for
       conversions.  (Database.link_refs): Add conversions argument to
       schemas.link_refs call.  (Database.diff_map): Call
       conversions.diff_map.
     * pyrseas/dbobject/conversion.py: New module to implement
       conversions.
     * pyrseas/dbobject/schema.py (Schema.to_map): Process conversions.
       (SchemaDict.from_map): Process input conversions.
       (SchemaDict.link_refs): Add argument for conversions.
     * tests/dbobject/__init__.py: Invoke conversion tests.
     * tests/dbobject/test_conversion.py: New test module.
     * tests/dbobject/utils.py (PostgresDb.clear): Drop existing
       conversions.
Commits on Aug 9, 2011
  1. @jmafc

    Add support for casts.

    jmafc authored
     * docs/cast.rst: New page to document casts.
     * docs/index.rst: Add cast.rst.
     * pyrseas/database.py (Database.Dicts.__init__): Add dictionary for
       casts.  (Database.from_map): Process input casts.
       (Database.to_map): Call casts.to_map.  (Database.diff_map): Call
       casts.diff_map.
     * pyrseas/dbobject/__init__.py (DbObject.keylist): Add 'name' as
       default element.  (DbObject.identifier): Return the value of the
       first keylist element.
     * pyrseas/dbobject/cast.py: New module to implement casts.
     * tests/dbobject/__init__.py: Invoke cast tests.
     * tests/dbobject/test_cast.py: New test module.
Commits on Aug 4, 2011
  1. @jmafc

    Add support for composite types.

    jmafc authored
     * docs/type.rst: Add Composite documentation.
     * pyrseas/database.py (Database.link_refs): Add columns argument to
       call of types.link_refs.
     * pyrseas/dbobject/column.py (ColumnDict.query): Add relkind = 'c' to
       WHERE clause.  (ColumnDict.from_map): Adjust for mapping of
       composite attributes, which only have a data type.
     * pyrseas/dbobject/dbtype.py (Composite): New class for this
       functionality.  (TypeDict.query): Retrieve composite types but only
       if pg_class.relkind is also 'c'.  (TypeDict.{_from_catalog,
       from_map}): Process composite types.  (TypeDict.link_refs): Process
       new dbcolumns argument for composite type attributes.
     * pyrseas/dbobject/schema.py (SchemaDict.link_refs): Handle
       Composites together with Enums.
     * pyrseas/dbobject/table.py (ClassDict.link_refs): Some columns may
       now belong to composite types, rather than tables.
     * tests/dbobject/test_type.py: Add new tests for composites.
Commits on Aug 2, 2011
  1. @jmafc

    Add support for dynamically loaded C language functions.

    jmafc authored
     * pyrseas/dbobject/function.py (Function.to_map): If obj_file is
       present, map source as link_symbol.  (Function.create): If obj_file
       is present, output AS obj_file, link_symbol instead of AS source
       text, and output AS clause last.  (ProcDict.query): Retrieve
       pg_proc.probin as obj_file.  (ProcDict.from_map): Validate that
       either source or obj_file are present, but not both.
     * pyrseas/dbobject/language.py (LanguageDict.link_refs): Don't link C
       language functions.
     * tests/dbobject/test_function.py: Add tests to map and create C
       language functions. Other changes due to AS clause being last.
Commits on Jul 28, 2011
  1. @jmafc

    Add support for operators.

    jmafc authored
     * docs/index.rst: Add operator.rst.
     * docs/operator.rst: New page to document operators.
     * pyrseas/database.py (Database.Dicts.__init__): Add dictionary for
       operators.  (Database._link_refs): Add operators argument when
       calling schemas.link_refs.  (Database.diff_map): Call
       operators.diff_map and _drop..
     * pyrseas/dbobject/operator.py: New module to implement operators.
     * pyrseas/dbobject/schema.py (Schema.to_map): Map operators if
       present.  (SchemaDict.from_map): Handle operators.
       (SchemaDict.link_refs): Add dbopers argument and traverse it to
       link operators.
     * tests/dbobject/__init__.py: Invoke operator tests.
     * tests/dbobject/test_operator.py: New test module.
     * tests/dbobject/utils.py (PostgresDb.clear): Drop operators.
Commits on Jul 19, 2011
  1. @jmafc

    Add support for constraint triggers.

    jmafc authored
     * docs/trigger.rst: Indicate that the Trigger class now covers both
       regular and constraint triggers.
     * pyrseas/dbobject/trigger.py (Trigger.create): Add support for
       CONSTRAINT, DEFERRABLE and INITIALLY DEFERRED keywords.
       (TriggerDict.query): Change to select constraint triggers and their
       features.
     * tests/dbobject/test_trigger.py: New test classes for constraint
       triggers.
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.py (Function.create): Output SECURITY
       DEFINER if needed.  (ProcDict.query): Retrieve prosecdef.
     * tests/dbobject/test_function.py: New tests for SECURITY DEFINER
       functions.
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.py (Function.to_map): Don't expose
       dependent_table.  (Function.create): If function has a dependent
       table, create that first.
     * pyrseas/dbobject/schema.py (SchemaDict.link_refs): Add
       dependent_table attribute to functions returning row types, and
       link back the tables to the function.
     * pyrseas/dbobject/table.py (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/test_function.py: New tests for void function and
       functions returning a set of rows.
Something went wrong with that request. Please try again.