MCPcopy Index your code
hub / github.com/pgadmin-org/pgadmin4 / __fetch_dependency

Method __fetch_dependency

web/pgadmin/browser/utils.py:551–724  ·  view source on GitHub ↗

This function is used to fetch the dependency for the selected node. Args: conn: Connection object query: sql query to fetch dependencies/dependents show_system_objects: System object status is_schema_diff: True when function gets cal

(self, conn, query, show_system_objects=None,
                           is_schema_diff=False)

Source from the content-addressed store, hash-verified

549 return dependents
550
551 def __fetch_dependency(self, conn, query, show_system_objects=None,
552 is_schema_diff=False):
553 """
554 This function is used to fetch the dependency for the selected node.
555
556 Args:
557 conn: Connection object
558 query: sql query to fetch dependencies/dependents
559 show_system_objects: System object status
560 is_schema_diff: True when function gets called from schema diff.
561
562 Returns: Dictionary of dependency for the selected node.
563 """
564
565 standard_types = {
566 'r': None,
567 'i': 'index',
568 'S': 'sequence',
569 'v': 'view',
570 'p': 'partition_table',
571 'f': 'foreign_table',
572 'm': 'materialized_view',
573 't': 'toast_table',
574 'I': 'partition_index'
575 }
576
577 # Dictionary for the object types
578 custom_types = {
579 'x': 'external_table', 'n': 'schema', 'd': 'domain',
580 'l': 'language', 'Cc': 'check', 'Cd': 'domain_constraints',
581 'Cf': 'foreign_key', 'Cp': 'primary_key', 'Co': 'collation',
582 'Cu': 'unique_constraint', 'Cx': 'exclusion_constraint',
583 'Fw': 'foreign_data_wrapper', 'Fs': 'foreign_server',
584 'Fc': 'fts_configuration', 'Fp': 'fts_parser',
585 'Fd': 'fts_dictionary', 'Ft': 'fts_template',
586 'Ex': 'extension', 'Et': 'event_trigger', 'Pa': 'package',
587 'Pf': 'function', 'Pt': 'trigger_function', 'Pp': 'procedure',
588 'Rl': 'rule', 'Rs': 'row_security_policy', 'Sy': 'synonym',
589 'Ty': 'type', 'Tr': 'trigger', 'Tc': 'compound_trigger',
590 'c': 'type',
591 # None specified special handling for this type
592 'A': None
593 }
594
595 # Merging above two dictionaries
596 types = {**standard_types, **custom_types}
597
598 # Dictionary for the restrictions
599 dep_types = {
600 # None specified special handling for this type
601 'n': 'normal',
602 'a': 'auto',
603 'i': None,
604 'p': None
605 }
606
607 status, result = conn.execute_dict(query)
608 if not status:

Callers 2

get_dependenciesMethod · 0.95
get_dependentsMethod · 0.95

Calls 3

errorMethod · 0.80
appendMethod · 0.80
execute_dictMethod · 0.45

Tested by

no test coverage detected