Skip to content

Commit d5bdbe6

Browse files
committed
readme
1 parent a677277 commit d5bdbe6

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

README.md

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ yarn add @classmethod/athena-query @aws-sdk/client-athena
2424

2525
## Usage
2626

27+
### Basic Usage
28+
2729
Athena-Query provide [async generator function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/async_function*).
2830
So we can use it with `for await () {}`,
2931

@@ -41,6 +43,33 @@ for await (const item of athenaQuery.query("SELECT * FROM waf_logs;")) {
4143

4244
And if you break loop out, Athena-Query don't call unnecessary pages of `get-query-result` api.
4345

46+
### Options
47+
48+
When you initialize AthenaQuery class, you can pass options to specify the query target.
49+
50+
```ts
51+
const athenaQuery = new AthenaQuery(athena, {
52+
db: "test-db",
53+
workgroup: "test-workgroup",
54+
catalog: "test-catalog",
55+
});
56+
```
57+
58+
When you query to Athena, you can pass options for query.
59+
60+
```ts
61+
const resultGen = athenaQuery.query(
62+
`
63+
SELECT * FROM waf_logs
64+
WHERE name = ? AND groupId = ? AND score > ?;
65+
`,
66+
{
67+
executionParameters: ["test", 123, 456n],
68+
maxResults: 100,
69+
}
70+
);
71+
```
72+
4473
## Release
4574

4675
See [here](https://www.notion.so/athena-query-8d4fd5d098b944028dd9c7066a47ffe4#ee977ecfee9840c09e8d7b5a2ed5d3e3). (private)

0 commit comments

Comments
 (0)