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 4 commits
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
6 changes: 6 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,12 @@ class ModuleDocFragment(object):
type: dict
default: {}

flatten_nested:
description:
- Sets the C(flatten_nested) setting on session before running the query.
type: int
choices: [0, 1]
version_added: '0.5.0'
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'),
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)
result = execute_query(module, client, query, execute_kwargs)

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