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

Class SearchObjectsHelper

web/pgadmin/tools/search_objects/utils.py:27–152  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

25
26
27class SearchObjectsHelper:
28 def __init__(self, sid, did, show_system_objects=False, node_types=None):
29 self.sid = sid
30 self.did = did
31 self.show_system_objects = show_system_objects
32 self.manager = get_driver(
33 PG_DEFAULT_DRIVER
34 ).connection_manager(sid)
35
36 self._all_node_types = [
37 'cast', 'fts_dictionary', 'check_constraint',
38 'exclusion_constraint', 'foreign_key',
39 'primary_key', 'unique_constraint', 'constraints', 'trigger',
40 'table', 'compound_trigger', 'rule', 'column', 'partition',
41 'index', 'type', 'domain', 'domain_constraints', 'schema',
42 'synonym', 'sequence', 'edbvar', 'edbfunc', 'edbproc', 'package',
43 'foreign_table', 'fts_parser', 'function', 'procedure',
44 'trigger_function', 'fts_template', 'collation', 'view', 'mview',
45 'fts_configuration', 'extension', 'language',
46 'event_trigger', 'foreign_server', 'user_mapping',
47 'foreign_data_wrapper', 'row_security_policy',
48 'publication', 'subscription', 'aggregate', 'operator'
49 ] if node_types is None else node_types
50
51 @property
52 def all_node_types(self):
53 return self._all_node_types
54
55 def get_template_path(self):
56 return 'search_objects/sql/{0}/#{1}#'.format(
57 self.manager.server_type, self.manager.version)
58
59 def get_show_node_prefs(self):
60 return_types = {}
61 for node_type in self.all_node_types:
62 blueprint = get_node_blueprint(node_type)
63 if blueprint is None:
64 continue
65
66 return_types[node_type] = blueprint.show_node
67 return return_types
68
69 def get_supported_types(self, skip_check=False):
70 return_types = {}
71 for node_type in self.all_node_types:
72 blueprint = get_node_blueprint(node_type)
73 if blueprint is None:
74 continue
75
76 if blueprint.backend_supported(self.manager, is_catalog=False,
77 did=self.did) or skip_check:
78 if node_type in ['edbfunc', 'edbproc']:
79 return_types[node_type] =\
80 gettext('Package {0}').format(
81 blueprint.collection_label)
82 else:
83 return_types[node_type] = blueprint.collection_label
84

Callers 3

typesFunction · 0.90
searchFunction · 0.90
runTestMethod · 0.90

Calls

no outgoing calls

Tested by 1

runTestMethod · 0.72