Skip to content

Commit 530c1a0

Browse files
dtaniwakilucydodo
andauthored
Support result reuse in Athena data sources (#7202)
* Support result reuse * Update pyathena to 2.25.2 * Separate options * Regenerate the Poetry lock file --------- Co-authored-by: SeongTae Jeong <seongtaejg@gmail.com>
1 parent 52dc176 commit 530c1a0

File tree

3 files changed

+65
-11
lines changed

3 files changed

+65
-11
lines changed

poetry.lock

Lines changed: 50 additions & 9 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ pandas = "1.3.4"
118118
phoenixdb = "0.7"
119119
pinotdb = ">=0.4.5"
120120
protobuf = "3.20.2"
121-
pyathena = ">=1.5.0,<=1.11.5"
121+
pyathena = "2.25.2"
122122
pydgraph = "2.0.2"
123123
pydruid = "0.5.7"
124124
pyexasol = "0.12.0"

redash/query_runner/athena.py

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,15 +90,26 @@ def configuration_schema(cls):
9090
"title": "Athena cost per Tb scanned (USD)",
9191
"default": 5,
9292
},
93+
"result_reuse_enable": {
94+
"type": "boolean",
95+
"title": "Reuse Athena query results",
96+
},
97+
"result_reuse_minutes": {
98+
"type": "number",
99+
"title": "Minutes to reuse Athena query results",
100+
"default": 60,
101+
},
93102
},
94103
"required": ["region", "s3_staging_dir"],
95-
"extra_options": ["glue", "catalog_ids", "cost_per_tb"],
104+
"extra_options": ["glue", "catalog_ids", "cost_per_tb", "result_reuse_enable", "result_reuse_minutes"],
96105
"order": [
97106
"region",
98107
"s3_staging_dir",
99108
"schema",
100109
"work_group",
101110
"cost_per_tb",
111+
"result_reuse_enable",
112+
"result_reuse_minutes",
102113
],
103114
"secret": ["aws_secret_key"],
104115
}
@@ -247,6 +258,8 @@ def run_query(self, query, user):
247258
kms_key=self.configuration.get("kms_key", None),
248259
work_group=self.configuration.get("work_group", "primary"),
249260
formatter=SimpleFormatter(),
261+
result_reuse_enable=self.configuration.get("result_reuse_enable", False),
262+
result_reuse_minutes=self.configuration.get("result_reuse_minutes", 60),
250263
**self._get_iam_credentials(user=user),
251264
).cursor()
252265

0 commit comments

Comments
 (0)