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

added option to disable flatten nested #63

Merged
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
8 changes: 8 additions & 0 deletions plugins/doc_fragments/client_inst_opts.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,14 @@ class ModuleDocFragment(object):
type: dict
default: {}

flatten_nested:
description:
- Updates flatten_nested setting on session before running
query
- Only runs the update if set to 0
type: int
default: 1

tmahany419 marked this conversation as resolved.
Show resolved Hide resolved
requirements: [ 'clickhouse-driver' ]

notes:
Expand Down
1 change: 1 addition & 0 deletions plugins/module_utils/clickhouse.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ def client_common_argument_spec():
login_user=dict(type='str', default=None),
login_password=dict(type='str', default=None, no_log=True),
client_kwargs=dict(type='dict', default={}),
flatten_nested=dict(type='int', default=1),
tmahany419 marked this conversation as resolved.
Show resolved Hide resolved
)


Expand Down
3 changes: 3 additions & 0 deletions plugins/modules/clickhouse_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,7 @@ def main():
client_kwargs = module.params['client_kwargs']
query = module.params['execute']
execute_kwargs = module.params['execute_kwargs']
flatten_nested = module.params['flatten_nested']
# The reason why these arguments are separate from client_kwargs
# is that we need to protect some sensitive data like passwords passed
# to the module from logging (see the arguments above with no_log=True);
Expand All @@ -283,6 +284,8 @@ def main():
substituted_query = get_substituted_query(module, client, query, execute_kwargs)

# Execute query
if flatten_nested == 0:
execute_query(module, client, "set flatten_nested=0;", execute_kwargs)
tmahany419 marked this conversation as resolved.
Show resolved Hide resolved
result = execute_query(module, client, query, execute_kwargs)

# Convert values not supported by ansible-core
Expand Down
Loading