Skip to content

Commit

Permalink
Deleted get_functions
Browse files Browse the repository at this point in the history
  • Loading branch information
aleksvagachev committed Sep 22, 2024
1 parent 49798dd commit 438df9b
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 58 deletions.
38 changes: 0 additions & 38 deletions plugins/modules/clickhouse_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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,
}
Expand Down
20 changes: 0 additions & 20 deletions tests/integration/targets/clickhouse_info/tasks/initial.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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"] != {}

0 comments on commit 438df9b

Please sign in to comment.