Skip to content

Commit

Permalink
quilt3.admin.tabulator: get/set open query (#4260)
Browse files Browse the repository at this point in the history
Co-authored-by: Sergey Fedoseev <[email protected]>
  • Loading branch information
nl0 and sir-sigurd authored Dec 19, 2024
1 parent e7743a7 commit fbab903
Show file tree
Hide file tree
Showing 10 changed files with 162 additions and 1 deletion.
14 changes: 14 additions & 0 deletions api/python/quilt3-admin/queries.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -241,3 +241,17 @@ mutation bucketTabulatorTableRename($bucketName: String!, $tableName: String!, $
}
}
}

query tabulatorGetOpenQuery {
admin {
tabulatorOpenQuery
}
}

mutation tabulatorSetOpenQuery($enabled: Boolean!) {
admin {
setTabulatorOpenQuery(enabled: $enabled) {
tabulatorOpenQuery
}
}
}
11 changes: 11 additions & 0 deletions api/python/quilt3/admin/_graphql_client/__init__.py

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

46 changes: 46 additions & 0 deletions api/python/quilt3/admin/_graphql_client/client.py

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 14 additions & 0 deletions api/python/quilt3/admin/tabulator.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,17 @@ def rename_table(bucket_name: str, table_name: str, new_table_name: str) -> None
"""
result = util.get_client().bucket_tabulator_table_rename(bucket_name, table_name, new_table_name)
util.handle_errors(result)


def get_open_query() -> bool:
"""
Get the **open query** status.
"""
return util.get_client().tabulator_get_open_query()


def set_open_query(enabled: bool) -> None:
"""
Set the **open query** status.
"""
util.get_client().tabulator_set_open_query(enabled)
17 changes: 17 additions & 0 deletions api/python/tests/test_admin_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -423,3 +423,20 @@ def test_tabulator_rename(data, result):
admin.tabulator.rename_table("test", "table", "new_table")
else:
assert admin.tabulator.rename_table("test", "table", "new_table") == result


def test_tabulator_get_open_query():
with mock_client(
_make_nested_dict("admin.tabulator_open_query", True),
"tabulatorGetOpenQuery",
):
assert admin.tabulator.get_open_query() is True


def test_tabulator_set_open_query():
with mock_client(
_make_nested_dict("admin.set_tabulator_open_query.tabulator_open_query", True),
"tabulatorSetOpenQuery",
variables={"enabled": True},
):
assert admin.tabulator.set_open_query(True) is None
6 changes: 6 additions & 0 deletions docs/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,12 @@ Entries inside each section should be ordered by type:
## CLI
!-->

# unreleased - YYYY-MM-DD

## Python API

* [Added] `quilt3.admin.tabulator`: `get_open_query()` and `set_open_query()` functions for managing Tabulator open query mode ([#4260](https://github.com/quiltdata/quilt/pull/4260))

# 6.1.1 - 2024-11-21

## Python API
Expand Down
4 changes: 3 additions & 1 deletion docs/advanced-features/tabulator.md
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,9 @@ Tabulator.

### 1. Enable Open Query

An admin can enable open query via the Admin UI:
An admin can enable open query via the `quilt3.admin.tabulator.set_open_query()`
[API](../api-reference/Admin.md#set_open_query)
or Admin UI:

![Tabulator Settings](../imgs/admin-tabulator-settings.png)

Expand Down
10 changes: 10 additions & 0 deletions docs/api-reference/Admin.md
Original file line number Diff line number Diff line change
Expand Up @@ -165,3 +165,13 @@ Set the tabulator table configuration. Pass `None` to remove the table.

Rename tabulator table.


## get\_open\_query() -> bool {#get\_open\_query}

Get the **open query** status.


## set\_open\_query(enabled: bool) -> None {#set\_open\_query}

Set the **open query** status.

0 comments on commit fbab903

Please sign in to comment.