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

Function compare_schema_objects

web/pgadmin/tools/schema_diff/__init__.py:862–933  ·  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

860
861
862def compare_schema_objects(**kwargs):
863 """
864 This function is used to compare the specified schema and their children.
865
866 :param kwargs:
867 :return:
868 """
869 trans_id = kwargs.get('trans_id')
870 session_obj = kwargs.get('session_obj')
871 source_sid = kwargs.get('source_sid')
872 source_did = kwargs.get('source_did')
873 source_scid = kwargs.get('source_scid')
874 target_sid = kwargs.get('target_sid')
875 target_did = kwargs.get('target_did')
876 target_scid = kwargs.get('target_scid')
877 schema_name = kwargs.get('schema_name')
878 diff_model_obj = kwargs.get('diff_model_obj')
879 total_percent = kwargs.get('total_percent')
880 node_percent = kwargs.get('node_percent')
881 is_schema_source_only = kwargs.get('is_schema_source_only', False)
882 ignore_owner = kwargs.get('ignore_owner')
883 ignore_whitespaces = kwargs.get('ignore_whitespaces')
884 ignore_tablespace = kwargs.get('ignore_tablespace')
885 ignore_grants = kwargs.get('ignore_grants')
886
887 source_schema_name = None
888 if is_schema_source_only:
889 driver = get_driver(PG_DEFAULT_DRIVER)
890 source_schema_name = driver.qtIdent(None, schema_name)
891
892 comparison_result = []
893
894 all_registered_nodes = SchemaDiffRegistry.get_registered_nodes()
895 for node_name, node_view in all_registered_nodes.items():
896 view = SchemaDiffRegistry.get_node_view(node_name)
897 if hasattr(view, 'compare'):
898 if schema_name == SCH_OBJ_STR:
899 msg = gettext('Comparing {0} '). \
900 format(gettext(view.blueprint.collection_label))
901 else:
902 msg = gettext('Comparing {0} of schema \'{1}\''). \
903 format(gettext(view.blueprint.collection_label),
904 gettext(schema_name))
905 app.logger.debug(msg)
906 socketio.emit('compare_status', {'diff_percentage': total_percent,
907 'compare_msg': msg}, namespace=SOCKETIO_NAMESPACE,
908 to=request.sid)
909 # Update the message and total percentage in session object
910 update_session_diff_transaction(trans_id, session_obj,
911 diff_model_obj)
912
913 res = view.compare(source_sid=source_sid,
914 source_did=source_did,
915 source_scid=source_scid,
916 target_sid=target_sid,
917 target_did=target_did,
918 target_scid=target_scid,
919 group_name=gettext(schema_name),

Callers 2

compare_databaseFunction · 0.85
compare_schemaFunction · 0.85

Calls 9

get_driverFunction · 0.90
gettextFunction · 0.85
qtIdentMethod · 0.80
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