Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deleted get_functions #81

Merged
merged 2 commits into from
Sep 26, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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"] != {}
Loading