Skip to content

Commit

Permalink
added support for flatten nested
Browse files Browse the repository at this point in the history
  • Loading branch information
tmahany authored and tmahany committed Jun 26, 2024
1 parent d4cadbf commit 901caee
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 0 deletions.
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
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),
)


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

0 comments on commit 901caee

Please sign in to comment.