Skip to content

Commit 87641b0

Browse files
docs: update overview of the project
* Add list of supported APIs * Reorganize root pages in repo and on the website * Fix broken links
1 parent e15f11d commit 87641b0

File tree

7 files changed

+87
-51
lines changed

7 files changed

+87
-51
lines changed

README.md

Lines changed: 31 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,26 @@
1-
# garf - Framework for interacting with reporting APIs
1+
# garf - Python library for interacting with reporting APIs
22

3-
`garf` is a framework for building various connectors to reporting API that provides
3+
`garf` is a Python library for building various connectors to reporting API that provides
44
users with a SQL-like interface to specify what needs to be extracted from the API.
55

6-
It allows you to define SQL-like queries alongside aliases and custom extractors and specify where the results of such query should be stored.\
7-
Based on a query `garf` builds the correct request to a reporting API, parses response
8-
and transform it into a structure suitable for writing data.
6+
Write a query and `garf` will do the rest- build the correct request to an API, parse response
7+
and writes it virtually anywhere.
98

109
## Key features
1110

12-
* SQL-like syntax to interact with reporting APIs
13-
* Built-in support for writing data into various local / remote storage
14-
* Available as library, CLI, FastAPI endpoint
15-
* Easily extendable to support various APIs
11+
* Rich [SQL-like syntax](https://google.github.io/garf/usage/queries/) to interact with reporting APIs.
12+
* Built-in support for [writing data](https://google.github.io/garf/usage/writers/) into various local / remote storage.
13+
* Built-in support for post-processing saved data in [BigQuery](https://google.github.io/garf/usage/bq-executor/) & [SQL](https://google.github.io/garf/usage/sql-executor/) databases.
14+
* Easily [extendable](https://google.github.io/garf/development/overview/) to support various APIs.
15+
* Available as library, CLI, FastAPI endpoint.
16+
17+
18+
## Supported APIs
19+
20+
* [YouTube Data API](https://google.github.io/garf/fetchers/youtube-data-api/)
21+
* [YouTube Reporting API](https://google.github.io/garf/fetchers/youtube-reporting-api/)
22+
* [Google Analytics](https://google.github.io/garf/fetchers/google-analytics-api/)
23+
* [Google Merchant Center](https://google.github.io/garf/fetchers/merchant-center-api/)
1624

1725

1826
## Installation
@@ -21,36 +29,34 @@ and transform it into a structure suitable for writing data.
2129
pip install garf-executors
2230
```
2331

24-
2532
## Usage
2633

34+
### Use `garf` CLI tool to fetch data from an API
35+
36+
```bash
37+
echo 'SELECT id, name AS model, data.color AS color FROM objects' > query.sql
38+
garf query.sql --source rest --source.endpoint=https://api.restful-api.dev
39+
```
40+
2741
### Get data from API to use in your code
2842

2943
```python
30-
from garf_core import ApiReportFetcher
31-
from garf_core.api_clients import FakeApiClient
44+
from garf_core.report_fetcher import ApiReportFetcher
45+
from garf_core.api_clients import RestApiClient
3246
from garf_io import writer
3347

34-
my_api_client = FakeApiClient(results=[{'field': 1}])
35-
fetcher = ApiReportFetcher(my_api_client)
36-
report = fetcher.fetch('SELECT field FROM resource_name')
48+
api_client = RestApiClient(endpoint='https://api.restful-api.dev')
49+
fetcher = ApiReportFetcher(api_client)
50+
query = 'SELECT id, name AS model, data.color AS color FROM objects'
51+
report = fetcher.fetch(query)
3752

3853
# Convert to Pandas
3954
report.to_pandas()
4055

4156
# Write to CSV
42-
writer.create_writer('csv').write(report, 'api_data')
43-
57+
writer.create_writer('console').write(report, 'api_data')
4458
```
4559

46-
### Use `garf` CLI tool to fetch data from an API
47-
48-
49-
```bash
50-
garf /path/to/queries \
51-
--source youtube --source.channel=MY_CHANNEL_ID \
52-
--output csv
53-
```
5460

5561
## Documentation
5662

docs/development/create-garf-library.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,4 +109,4 @@ garf query.sql --source YOUR_API
109109
```
110110

111111
!!!note
112-
Refer to [instructions](../libs/garf_executors/README.md#usage) for fetching data from your api via `garf` CLI tool.
112+
Refer to [instructions](../usage/executors.md) for fetching data from your API via `garf` CLI tool.

docs/fetchers/youtube-reporting-api.md

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,23 +4,30 @@
44

55
Install `garf-youtube-reporting-api` library
66

7+
/// tab | pip
78
```
89
pip install garf-executors garf-youtube-reporting-api
910
```
11+
///
12+
13+
/// tab | uv
14+
```
15+
uv add garf-executors garf-youtube-reporting-api
16+
```
17+
///
1018

1119
## Usage
1220

1321
```
1422
garf <PATH_TO_QUERIES> --source youtube-reporting-api \
15-
--output <OUTPUT_TYPE> \
16-
--source.<SOURCE_PARAMETER=VALUE>
23+
--output csv \
24+
--source.id=YOUTUBE_CHANNEL_ID
1725
```
1826

1927
where:
2028

21-
* `<PATH_TO_QUERIES>` - local or remove files containing queries
22-
* `<OUTPUT_TYPE>` - output supported by [`garf-io` library](../garf_io/README.md).
23-
* `<SOURCE_PARAMETER=VALUE` - key-value pairs to refine fetching, check [available source parameters](#available-source-parameters).
29+
* `query` - local or remote path(s) to files with queries.
30+
* `output` - output supported by [`garf-io` library](https://google.github.io/garf/usage/writers/).
2431

2532
### Available source parameters
2633

docs/get-started/cli.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@ garf <QUERIES> --source <API_SOURCE> \
1818

1919
where
2020

21-
* `<QUERIES>`- local or remote path(s) to files with queries.
22-
* `<API_SOURCE>`- type of API to use. Based on that the appropriate report fetcher will be initialized.
23-
* `<OUTPUT_TYPE>` - output supported by [`garf-io` library](../garf_io/README.md).
21+
* `query` - local or remote path(s) to files with queries.
22+
* `source`- type of API to use. Based on that the appropriate report fetcher will be initialized.
23+
* `output` - output supported by [`garf-io` library](https://google.github.io/garf/usage/writers/).
2424

2525
If your report fetcher requires additional parameters you can pass them via key value pairs under `--source.` argument, i.e.`--source.regionCode='US'` - to get data only from *US*.
2626
> Concrete `--source` parameters are dependent on a particular report fetcher and should be looked up in a documentation for this fetcher.

docs/get-started/index.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
# Overview
22

3-
Garf allows you to define SQL-like queries alongside aliases and custom extractors and specify where the results of such query should be stored.
4-
Based on such a query the library constructs the correct query to a reporting API of your choice, automatically extract all necessary fields from API schema
5-
and transform them into a structure suitable for writing data.
3+
`garf` can be used in a multiple ways.
64

75
<div class="grid cards" markdown>
86

docs/index.md

Lines changed: 38 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,28 @@
1-
# garf
1+
# garf - Python library for interacting with reporting APIs
22

33
## What is garf?
44

5-
`garf` is a framework for building various connectors to reporting API that provides
5+
`garf` is a Python library for building various connectors to reporting API that provides
66
users with a SQL-like interface to specify what needs to be extracted from the API.
77

8-
It allows you to define SQL-like queries alongside aliases and custom extractors
9-
and specify where the results of such query should be stored.
10-
Based on a query `garf` builds the correct request to a reporting API, parses response
11-
and transform it into a structure suitable for writing data.
8+
Write a query and `garf` will do the rest- build the correct request to an API, parse response
9+
and writes it virtually anywhere.
1210

1311
## Key features
1412

1513

16-
* SQL-like syntax to interact with reporting APIs
17-
* Built-in support for writing data into various local / remote storage
18-
* Available as library, CLI, FastAPI endpoint
19-
* Easily extendable to support various APIs
14+
* Rich [SQL-like syntax](usage/queries.md) to interact with reporting APIs.
15+
* Built-in support for [writing data](usage/writers.md) into various local / remote storage.
16+
* Easily [extendable](development/overview.md) to support various APIs.
17+
* Built-in support for post-processing saved data in [BigQuery](usage/bq-executor.md) & [SQL](usage/sql-executor.md) databases.
18+
* Available as library, CLI, FastAPI endpoint.
2019

20+
## Supported APIs
21+
22+
* [YouTube Data API](fetchers/youtube-data-api.md)
23+
* [YouTube Reporting API](fetchers/youtube-reporting-api.md)
24+
* [Google Analytics](fetchers/google-analytics-api.md)
25+
* [Google Merchant Center](fetchers/merchant-center-api.md)
2126

2227
## Installation
2328

@@ -36,8 +41,28 @@ uv add garf-executors
3641

3742
## Usage
3843

44+
### CLI
45+
3946
```bash
40-
garf /path/to/queries \
41-
--source youtube --source.channel=MY_CHANNEL_ID \
42-
--output csv
47+
echo 'SELECT id, name AS model, data.color AS color FROM objects' > query.sql
48+
garf query.sql --source rest --source.endpoint=https://api.restful-api.dev
49+
```
50+
51+
### Python library
52+
53+
```python
54+
from garf_core.report_fetcher import ApiReportFetcher
55+
from garf_core.api_clients import RestApiClient
56+
from garf_io import writer
57+
58+
api_client = RestApiClient(endpoint='https://api.restful-api.dev')
59+
fetcher = ApiReportFetcher(api_client)
60+
query = 'SELECT id, name AS model, data.color AS color FROM objects'
61+
report = fetcher.fetch(query)
62+
63+
# Convert to Pandas
64+
report.to_pandas()
65+
66+
# Write to CSV
67+
writer.create_writer('console').write(report, 'api_data')
4368
```

docs/usage/bq-executor.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ garf <QUERIES> --source bq \
2323
where
2424

2525
* `query`- local or remote path(s) to files with queries.
26-
* `output` - output supported by [`garf-io` library](../garf_io/README.md).
26+
* `output` - output supported by [`garf-io` library](https://google.github.io/garf/usage/writers/).
2727
///
2828

2929
/// tab | Python

0 commit comments

Comments
 (0)