Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for aggregates, composite types, partitions, and more #90

Open
wants to merge 30 commits into
base: master
Choose a base branch
from

Conversation

joshainglis
Copy link

This pull request adds several enhancements and new features to schemainspect.

  • Support for inspecting aggregate functions. A new InspectedAggFunction class was added along with the query to retrieve aggregate function details. Aggregate functions are now included when comparing schemas.

  • Support for composite types. The dependency queries were updated to properly handle composite types. Tables based on composite types are now inspected as regular tables.

  • Partition tables are now handled - child partition tables are excluded from privilege and trigger inspection to avoid duplicate output.

  • Schema-level and function-level privileges are now included in addition to table-level privileges. The privilege query was significantly expanded to capture all privilege types.

  • Comments on all major object types (tables, views, columns, types, functions, etc) are now inspected using a new InspectedComment class and query.

  • Empty string schemas are now handled properly in the quoted_full_name property.

  • Various bug fixes, including:

    • Fixed issue where get_dependency_by_signature could return None
    • Fixed schema filtering in privilege query
    • Fixed an issue with negative stereotyping in the eq comparison
    • Corrected the drop statement for functions to use identity arguments
  • Enabled PEP 517 building in pyproject.toml

This PR builds on top of @biodevc's fork at https://github.com/biodevc/schemainspect

biodevc and others added 24 commits May 14, 2021 12:53
Currently only table privileges are handled
In the file 'triggers.sql', a subquery was added to exclude triggers related to partition child tables. The decision to exclude these triggers is based on the assumption that they inherit the triggers of their parent tables, so it is unnecessary to list them separately. This gives a clearer and more concise output from the triggers query, reducing redundancy and potential confusion.
The code is modified to exclude the partition child tables when checking for table privileges in the `privileges.sql` file. Earlier, the privileges check was including all the tables. With this change, the partitioned child tables, which generally do not require independent privileges, are excluded from the privileges check. This enhances the accuracy of the privilege validation process.
This commit adds new functionality to the codebase to allow inspection of aggregate database functions. The `InspectedAggFunction` class was added to `schemainspect/pg/obj.py`, with properties needed to create, describe, and delete aggregate functions. Moreover, `load_aggregate_functions` method was added to the `PostgreSQL` class in the same file to facilitate loading of these functions. Associated queries for getting this information are stored in `agg_functions.sql`. This was done to enhance the library's capabilities and cover more aspects of database inspecting.
joshainglis and others added 5 commits March 15, 2024 16:46
Modified the function identifier in schemainspect to include return type. Previously, function identification was only based on the function's full name and identity arguments. This change accommodates functions with identical arguments but different return types.

(cherry picked from commit 467a12b)
(cherry picked from commit 621e7b4)
Added the function result to the quoted and unquoted identifiers, as well as to the dependencies. This additional parameter was included in multiple functions and SQL queries, and it allows to better identify and manage dependencies in the 'schemainspect' Python module.

(cherry picked from commit 91fe044)
This can happen if a column is of a custom type and the
type is deleted with a cascade

(cherry picked from commit f2f5dff)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants