Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
578a046
Include VIEWS in privileges (aka role, permission)
biodevc May 14, 2021
bccde5d
Update privileges.sql
biodevc May 14, 2021
e32ab28
Also include SEQUENCE & COLUMN privileges
biodevc May 14, 2021
8816e8c
Add support for function priveleges
biodevc May 14, 2021
e6ba49c
Add support for schema priveleges
biodevc Oct 28, 2021
d04ca68
Add support for schema privileges
biodevc Oct 28, 2021
8d73ef3
Merge branch 'master' into patch-1
biodevc Jun 22, 2022
e01a4ee
Update privileges.sql
biodevc Jun 23, 2022
3689c45
Update inspected.py
biodevc Jun 23, 2022
6402a3a
pre-commit fixes
joshainglis Jun 28, 2022
1ffaf58
include defaults in create function sig
joshainglis Jul 5, 2022
5d2e808
Merge branch 'handle-function-defaults'
joshainglis Jul 28, 2022
14a1d7a
support for function privileges
joshainglis Jul 29, 2022
b4ca84b
Merge branch 'djrobstep:master' into master
joshainglis Jul 29, 2022
4197072
Merge remote-tracking branch 'upstream/master' into merge-upstream
joshainglis Oct 3, 2022
9d79b0d
add returntype to func comparison
joshainglis Oct 3, 2022
2df4dfd
handle comments and array dependencies
joshainglis Apr 12, 2023
a0bfc91
fix comment
joshainglis Apr 12, 2023
8fe1b38
improve dependency query
joshainglis Apr 12, 2023
a434855
more dependency handling
joshainglis Apr 12, 2023
0a0ca10
Add exclusion of partition child tables in triggers.sql
joshainglis Aug 28, 2023
1fe185b
Add exclusion of partition child tables in privileges.sql
joshainglis Sep 7, 2023
51d47d6
Add support for inspecting aggregate functions
joshainglis Sep 7, 2023
79b3fbd
revert python version minimum change
joshainglis Mar 15, 2024
a113246
update isort in .pre-commit-config.yaml to fix ci check
joshainglis Mar 15, 2024
044462d
run black
joshainglis Mar 15, 2024
c72c887
Add return type to function identity in schemainspect
joshainglis Apr 17, 2024
1d11052
handle void return
joshainglis Apr 17, 2024
cb1f6f2
Add function result to identifiers and dependencies
joshainglis Apr 17, 2024
eeda5c1
handle case where a relation has no columns
joshainglis Apr 24, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,6 @@ repos:
hooks:
- id: black
- repo: https://github.com/PyCQA/isort
rev: 5.10.1
rev: 5.13.2
hooks:
- id: isort
5 changes: 5 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,14 @@ isort = "5.10.1"
migra = "*"
black = "22.3.0"
toml = "*"
pre-commit = "*"

[tool.poetry.scripts]
schemainspect = 'schemainspect:do_command'

[tool.isort]
profile = "black"

[build-system]
requires = ["poetry-core>=1.0.0"]
build-backend = "poetry.core.masonry.api"
3 changes: 2 additions & 1 deletion schemainspect/command.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,12 @@ def do_deps(db_url):
deps = i.deps

def process_row(dep):
depends_on = quoted_identifier(dep.name, dep.schema, dep.identity_arguments)
depends_on = quoted_identifier(dep.name, dep.schema, dep.identity_arguments, dep.result)
thing = quoted_identifier(
dep.name_dependent_on,
dep.schema_dependent_on,
dep.identity_arguments_dependent_on,
dep.result_dependent_on,
)

return dict(
Expand Down
2 changes: 2 additions & 0 deletions schemainspect/inspected.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
class Inspected(AutoRepr):
@property
def quoted_full_name(self):
if self.schema == "":
return quoted_identifier(self.name)
return quoted_identifier(self.name, schema=self.schema)

@property
Expand Down
8 changes: 4 additions & 4 deletions schemainspect/misc.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,25 +42,25 @@ def __ne__(self, other):
return not self == other


def unquoted_identifier(identifier, *, schema=None, identity_arguments=None):
def unquoted_identifier(identifier, *, schema=None, identity_arguments=None, return_type=None):
if identifier is None and schema is not None:
return schema
s = "{}".format(identifier)
if schema:
s = "{}.{}".format(schema, s)
if identity_arguments is not None:
s = "{}({})".format(s, identity_arguments)
s = "{}({}) RETURNS {}".format(s, identity_arguments, return_type)
return s


def quoted_identifier(identifier, schema=None, identity_arguments=None):
def quoted_identifier(identifier, schema=None, identity_arguments=None, return_type=None):
if identifier is None and schema is not None:
return '"{}"'.format(schema.replace('"', '""'))
s = '"{}"'.format(identifier.replace('"', '""'))
if schema:
s = '"{}".{}'.format(schema.replace('"', '""'), s)
if identity_arguments is not None:
s = "{}({})".format(s, identity_arguments)
s = "{}({}) RETURNS {}".format(s, identity_arguments, return_type)
return s


Expand Down
Loading