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

Function compare_database_objects

web/pgadmin/tools/schema_diff/__init__.py:808–859  ·  view source on GitHub ↗

This function is used to compare the specified schema and their children. :param kwargs: :return:

(**kwargs)

Source from the content-addressed store, hash-verified

806
807
808def compare_database_objects(**kwargs):
809 """
810 This function is used to compare the specified schema and their children.
811
812 :param kwargs:
813 :return:
814 """
815 trans_id = kwargs.get('trans_id')
816 session_obj = kwargs.get('session_obj')
817 source_sid = kwargs.get('source_sid')
818 source_did = kwargs.get('source_did')
819 target_sid = kwargs.get('target_sid')
820 target_did = kwargs.get('target_did')
821 diff_model_obj = kwargs.get('diff_model_obj')
822 total_percent = kwargs.get('total_percent')
823 node_percent = kwargs.get('node_percent')
824 ignore_owner = kwargs.get('ignore_owner')
825 ignore_whitespaces = kwargs.get('ignore_whitespaces')
826 ignore_tablespace = kwargs.get('ignore_tablespace')
827 ignore_grants = kwargs.get('ignore_grants')
828 comparison_result = []
829
830 all_registered_nodes = SchemaDiffRegistry.get_registered_nodes(None,
831 'Database')
832 for node_name, node_view in all_registered_nodes.items():
833 view = SchemaDiffRegistry.get_node_view(node_name)
834 if hasattr(view, 'compare'):
835 msg = gettext('Comparing {0}'). \
836 format(gettext(view.blueprint.collection_label))
837 app.logger.debug(msg)
838 socketio.emit('compare_status', {'diff_percentage': total_percent,
839 'compare_msg': msg}, namespace=SOCKETIO_NAMESPACE,
840 to=request.sid)
841 # Update the message and total percentage in session object
842 update_session_diff_transaction(trans_id, session_obj,
843 diff_model_obj)
844
845 res = view.compare(source_sid=source_sid,
846 source_did=source_did,
847 target_sid=target_sid,
848 target_did=target_did,
849 group_name=gettext('Database Objects'),
850 ignore_owner=ignore_owner,
851 ignore_whitespaces=ignore_whitespaces,
852 ignore_tablespace=ignore_tablespace,
853 ignore_grants=ignore_grants)
854
855 if res is not None:
856 comparison_result = comparison_result + res
857 total_percent = total_percent + node_percent
858
859 return comparison_result, total_percent
860
861
862def compare_schema_objects(**kwargs):

Callers 1

compare_databaseFunction · 0.85

Calls 7

gettextFunction · 0.85
get_registered_nodesMethod · 0.80
get_node_viewMethod · 0.80
emitMethod · 0.80
getMethod · 0.45
compareMethod · 0.45

Tested by

no test coverage detected