mirror of
https://github.com/pgadmin-org/pgadmin4.git
synced 2025-02-25 18:55:31 -06:00
Added missing imports and remove unused imports from schema diff.
This commit is contained in:
parent
4f5c3987f1
commit
641701ca16
@ -11,9 +11,9 @@
|
||||
|
||||
import copy
|
||||
|
||||
from flask import render_template
|
||||
from pgadmin.utils.driver import get_driver
|
||||
from config import PG_DEFAULT_DRIVER
|
||||
from pgadmin.utils.ajax import internal_server_error
|
||||
from pgadmin.tools.schema_diff.directory_compare import compare_dictionaries,\
|
||||
directory_diff
|
||||
from pgadmin.tools.schema_diff.model import SchemaDiffModel
|
||||
|
@ -21,7 +21,7 @@ from flask_security import current_user, login_required
|
||||
from flask_babelex import gettext
|
||||
from pgadmin.utils import PgAdminModule
|
||||
from pgadmin.utils.ajax import make_json_response, bad_request, \
|
||||
make_response as ajax_response, not_implemented, internal_server_error
|
||||
make_response as ajax_response, internal_server_error
|
||||
from pgadmin.model import Server
|
||||
from pgadmin.tools.schema_diff.node_registry import SchemaDiffRegistry
|
||||
from pgadmin.tools.schema_diff.model import SchemaDiffModel
|
||||
@ -298,6 +298,7 @@ def get_server(sid, did):
|
||||
This function will return the server details for the specified
|
||||
server id.
|
||||
"""
|
||||
res = []
|
||||
try:
|
||||
"""Return a JSON document listing the server groups for the user"""
|
||||
driver = get_driver(PG_DEFAULT_DRIVER)
|
||||
|
@ -12,16 +12,15 @@
|
||||
import copy
|
||||
|
||||
from flask import render_template
|
||||
from pgadmin.utils.compile_template_name import compile_template_path
|
||||
from pgadmin.utils.driver import get_driver
|
||||
from config import PG_DEFAULT_DRIVER
|
||||
from pgadmin.utils.ajax import internal_server_error
|
||||
from pgadmin.tools.schema_diff.directory_compare import compare_dictionaries,\
|
||||
directory_diff
|
||||
from pgadmin.tools.schema_diff.model import SchemaDiffModel
|
||||
from abc import abstractmethod
|
||||
|
||||
|
||||
class SchemaDiffObjectCompare():
|
||||
class SchemaDiffObjectCompare:
|
||||
|
||||
keys_to_ignore = ['oid', 'schema']
|
||||
|
||||
|
@ -23,6 +23,7 @@ def compare_dictionaries(source_dict, target_dict, node, node_label,
|
||||
:param source_dict: First Dictionary
|
||||
:param target_dict: Second Dictionary
|
||||
:param node: node type
|
||||
:param node_label: node label
|
||||
:param ignore_keys: List of keys that will be ignored while comparing
|
||||
:return:
|
||||
"""
|
||||
@ -108,6 +109,7 @@ def are_lists_identical(source_list, target_list, ignore_keys):
|
||||
This function is used to compare two list.
|
||||
:param source_list:
|
||||
:param target_list:
|
||||
:param ignore_keys: ignore keys to compare
|
||||
:return:
|
||||
"""
|
||||
if source_list is None or target_list is None or \
|
||||
@ -132,8 +134,9 @@ def are_dictionaries_identical(source_dict, target_dict, ignore_keys):
|
||||
"""
|
||||
This function is used to recursively compare two dictionaries with
|
||||
same keys.
|
||||
:param source_dict:
|
||||
:param target_dict:
|
||||
:param source_dict: source dict
|
||||
:param target_dict: target dict
|
||||
:param ignore_keys: ignore keys to compare
|
||||
:return:
|
||||
"""
|
||||
|
||||
@ -187,6 +190,7 @@ def directory_diff(source_dict, target_dict, ignore_keys=[], difference={}):
|
||||
:param source_dict: source dict
|
||||
:param target_dict: target dict
|
||||
:param ignore_keys: ignore keys to compare
|
||||
:param difference:
|
||||
"""
|
||||
|
||||
src_keys = set(source_dict.keys())
|
||||
@ -207,8 +211,8 @@ def directory_diff(source_dict, target_dict, ignore_keys=[], difference={}):
|
||||
if key in ignore_keys:
|
||||
pass
|
||||
elif key in tar_only:
|
||||
target_only[key] = target_dict[key]
|
||||
# Target only values in deleted list
|
||||
if type(target_dict[key]) is list:
|
||||
difference[key] = {}
|
||||
difference[key]['deleted'] = target_dict[key]
|
||||
elif key in src_only:
|
||||
# Source only values in the newly added list
|
||||
|
Loading…
Reference in New Issue
Block a user