From 9bb6bff56b13599b2198a9990f5300ea75ea5e23 Mon Sep 17 00:00:00 2001 From: Aleksandr Vagachev Date: Thu, 26 Sep 2024 08:30:34 +0300 Subject: [PATCH] Deleted get_functions (#81) * Deleted get_functions * Added changelogs --- changelogs/fragments/3-info_get_functions.yml | 2 + plugins/modules/clickhouse_info.py | 38 ------------------- .../targets/clickhouse_info/tasks/initial.yml | 20 ---------- 3 files changed, 2 insertions(+), 58 deletions(-) create mode 100644 changelogs/fragments/3-info_get_functions.yml diff --git a/changelogs/fragments/3-info_get_functions.yml b/changelogs/fragments/3-info_get_functions.yml new file mode 100644 index 0000000..8f70140 --- /dev/null +++ b/changelogs/fragments/3-info_get_functions.yml @@ -0,0 +1,2 @@ +breaking_changes: +- clickhouse_info - removed ``functions`` for collecting information of created functions. A rare and unpopular feature. diff --git a/plugins/modules/clickhouse_info.py b/plugins/modules/clickhouse_info.py index 81c0c7e..f8be573 100644 --- a/plugins/modules/clickhouse_info.py +++ b/plugins/modules/clickhouse_info.py @@ -145,15 +145,6 @@ type: dict sample: { "readonly": "..." } version_added: '0.4.0' -functions: - description: - - The content of the system.functions table with function names as keys. - - Works only for clickhouse-server versions >= 22. - - Does not output functions on the 'System' origin. - returned: success - type: dict - sample: { "test_function": "..." } - version_added: '0.4.0' storage_policies: description: - The content of the system.storage_policies table with storage_policies names as keys. @@ -635,34 +626,6 @@ def get_settings_profile_elements(module, client): return settings_profile_elements -def get_functions(module, client): - """Get functions. - - Returns a dictionary with function names as keys. - """ - srv_version = get_server_version(module, client) - function_info = {} - if srv_version['year'] >= 22: - query = ("SELECT name, is_aggregate, case_insensitive, alias_to, " - "create_query, origin FROM system.functions " - "WHERE origin != 'System'") - result = execute_query(module, client, query) - - if result == PRIV_ERR_CODE: - return {PRIV_ERR_CODE: "Not enough privileges"} - - for row in result: - function_info[row[0]] = { - "is_aggregate": str(row[1]), - "case_insensitive": row[2], - "alias_to": row[3], - "create_query": row[4], - "origin": row[5], - } - - return function_info - - def get_storage_policies(module, client): """Get storage_policies. @@ -763,7 +726,6 @@ def main(): 'quotas': get_quotas, 'settings_profiles': get_settings_profiles, 'settings_profile_elements': get_settings_profile_elements, - 'functions': get_functions, 'storage_policies': get_storage_policies, 'grants': get_all_grants, } diff --git a/tests/integration/targets/clickhouse_info/tasks/initial.yml b/tests/integration/targets/clickhouse_info/tasks/initial.yml index f424c1d..520d6ca 100644 --- a/tests/integration/targets/clickhouse_info/tasks/initial.yml +++ b/tests/integration/targets/clickhouse_info/tasks/initial.yml @@ -97,23 +97,3 @@ - result is not changed - result["version"] != {} - result["driver"]["version"] != {} - -- name: Check function - when: result['version']['year'] >= 22 - block: - - name: Create function - community.clickhouse.clickhouse_client: - execute: "CREATE FUNCTION linear_equation AS (x, k, b) -> k*x + b" - - - name: Get info - register: result_func - community.clickhouse.clickhouse_info: - login_host: localhost - limit: - - functions - - - name: Check result - ansible.builtin.assert: - that: - - result_func is not changed - - result_func["functions"] != {}