MCPcopy Create free account
hub / github.com/pgadmin-org/pgadmin4 / ERDHelper

Class ERDHelper

web/pgadmin/tools/erd/utils.py:104–144  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

102
103
104class ERDHelper:
105 def __init__(self, conn_id, sid, did):
106 self.conn_id = conn_id
107 self.did = did
108 self.sid = sid
109 self.table_view = ERDTableView()
110 self.link_view = None
111
112 def get_types(self):
113 return self.table_view.get_types(
114 conn_id=self.conn_id, did=self.did, sid=self.sid)
115
116 def get_geometry_types(self):
117 return self.table_view.get_geometry_types(
118 conn_id=self.conn_id, did=self.did, sid=self.sid
119 )
120
121 def get_table_sql(self, data, with_drop=False):
122 SQL, _ = self.table_view.sql(
123 conn_id=self.conn_id, did=self.did, sid=self.sid,
124 data=data, with_drop=with_drop)
125 return SQL
126
127 def get_all_tables(self, scid, tid):
128 if tid is None and scid is None:
129 status, res = self.table_view.fetch_all_tables(
130 did=self.did, sid=self.sid)
131 elif tid is None:
132 status, res = self.table_view.fetch_all_tables(
133 did=self.did, sid=self.sid, scid=scid)
134 else:
135 prefs = Preferences.module('erd')
136 table_relation_depth = prefs.preference('table_relation_depth')
137 related = {}
138 status, res = self.table_view.traverse_related_tables(
139 did=self.did, sid=self.sid, scid=scid, tid=tid,
140 related=related, maxdepth=table_relation_depth.get()
141 )
142 if status:
143 res = list(related.values())
144 return status, res

Callers 3

prequisiteFunction · 0.85
sqlFunction · 0.85
tablesFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected