|
1 | 1 | # firebolt-sdk |
2 | | - |
3 | 2 | ### Installation |
4 | 3 |
|
5 | 4 | * Requires Python `>=3.9` |
6 | 5 | * `pip install firebolt-sdk` |
7 | 6 |
|
8 | | -### Usage |
9 | | - |
10 | | -See: [examples.ipynb](examples.ipynb). |
11 | | - |
12 | | -### Configuration |
13 | | - |
14 | | -To use the SDK, you generally will want to set the following environment variables: |
15 | | -``` |
16 | | - |
17 | | -FIREBOLT_PASSWORD='*****' |
18 | | -FIREBOLT_SERVER='api.app.firebolt.io' |
19 | | -FIREBOLT_DEFAULT_REGION='us-east-1' |
20 | | -``` |
21 | | - |
22 | | -* You can store these in a `.env` file |
23 | | -* environment variables on your system always take precedence over those in `.env` |
24 | 7 |
|
25 | | -Once the environment variables are defined (either on your system or in `.env`), |
26 | | -you can initialize a ResourceManager with: |
| 8 | +## Connection parameters |
| 9 | +These parameters are used to connect to a Firebolt database: |
| 10 | +- **engine_url** - url for an engine to make requests to. Can be retrieved from Web UI, or from [engine](https://github.com/firebolt-db/firebolt-sdk/tree/master/src/firebolt/model/engine.py) attribute `endpoint` |
| 11 | +- **database** - name of the database to make queries to |
| 12 | +- **username** - account username |
| 13 | +- **password** - account password |
27 | 14 |
|
28 | | -```python |
29 | | -from firebolt.service.manager import ResourceManager |
| 15 | +Optional parameters |
| 16 | +- **api_endpoint** - api hostname for logging in. Defaults to `api.app.firebolt.io`. |
30 | 17 |
|
31 | | -rm = ResourceManager() |
32 | | -print(rm.regions.default_region) # see your default region |
33 | | -``` |
| 18 | +## Examples |
| 19 | +See [PEP-249](https://www.python.org/dev/peps/pep-0249) for the DB API reference and specifications. An example [jupyter notebook](https://github.com/firebolt-db/firebolt-sdk/tree/master/examples/dbapi.ipynb) is included to illustrate the use of the Firebolt API. |
34 | 20 |
|
35 | | -Or you can configure settings manually: |
36 | | - |
37 | | -```python |
38 | | -from firebolt.service.manager import ResourceManager |
39 | | -from firebolt.common.settings import Settings |
40 | | -from pydantic import SecretStr |
41 | | - |
42 | | -rm = ResourceManager(settings=Settings( |
43 | | - server="api.app.firebolt.io", |
44 | | - |
45 | | - password=SecretStr("*****"), |
46 | | - default_region="us-east-1", |
47 | | -)) |
48 | | -print(rm.client.account_id) # see your account id |
49 | | -``` |
| 21 | +### Contributing |
50 | 22 |
|
51 | | -Under the hood, configuration works via Pydantic, |
52 | | -see [here](https://pydantic-docs.helpmanual.io/usage/settings/). |
| 23 | +See: [CONTRIBUTING.MD](https://github.com/firebolt-db/firebolt-sdk/tree/master/CONTRIBUTING.MD) |
53 | 24 |
|
54 | | -### Contributing |
| 25 | +## License |
| 26 | +The Firebolt DB API is licensed under the [Apache License Version 2.0](https://github.com/firebolt-db/firebolt-sdk/tree/master/LICENSE) software license. |
55 | 27 |
|
56 | | -See: [CONTRIBUTING.MD](CONTRIBUTING.MD) |
| 28 | +<a rel="license" href="http://creativecommons.org/licenses/by/4.0/"><img alt="Creative Commons License" style="border-width:0" src="https://i.creativecommons.org/l/by/4.0/88x31.png" /></a> |
0 commit comments