You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+76-32Lines changed: 76 additions & 32 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,15 +1,17 @@
1
1
# QuestDB Python Library
2
2
3
-
A robust, strongly-typed Python library for interacting with QuestDB, providing an easy-to-use interface for querying, writing data, and managing logs.
3
+
A robust, strongly-typed Python library for interacting with QuestDB, providing an easy-to-use interface for querying and writing data, with additional features such as easy integration with the built in python logging library automatically saving all logs, including tracebacks and stack traces to DB. Easy set-up with docker-compose and a grafana dashboard is included.
4
4
5
-
## Features
5
+
## Key Features
6
6
7
7
- Asynchronous and synchronous query support
8
-
- Strongly-typed data structures
8
+
- Strongly-typed data structures using `msgspec`
9
9
- Easy data insertion with automatic flushing
10
10
- Pandas DataFrame integration
11
-
- Built-in logging handler for QuestDB
11
+
- Seamless logging integration with Python's built-in logging system
12
+
- Docker Compose setup for QuestDB with Prometheus and Grafana monitoring
12
13
- Comprehensive test coverage
14
+
- Optional error handling callback
13
15
14
16
## Installation
15
17
@@ -23,6 +25,7 @@ pip install py-questdb
23
25
24
26
```python
25
27
from py_questdb import QuestDB
28
+
from datetime import datetime
26
29
27
30
# Initialize QuestDB client
28
31
db = QuestDB(host="localhost", port=9000)
@@ -62,11 +65,43 @@ db = QuestDB()
62
65
db = QuestDB(host="questdb.example.com", port=9000, username="user", password="pass")
63
66
```
64
67
68
+
### Querying Data
69
+
70
+
```python
71
+
# Synchronous query
72
+
for row in db.query_sync("SELECT * FROM sensors WHERE location = 'NYC'"):
# The logs are written to QuestDB in real-time, allowing for immediate analysis and monitoring
176
+
```
177
+
178
+
This integration allows you to leverage QuestDB's powerful querying capabilities for log analysis, making it easy to search, filter, and analyze your application logs.
179
+
180
+
## Docker Compose Setup
181
+
182
+
The project includes a Docker Compose configuration to run QuestDB along with Prometheus for metrics collection and Grafana for visualization. To use this setup:
183
+
184
+
1. Navigate to the `/etc` directory in the project.
185
+
2. Run the following command:
186
+
187
+
```bash
188
+
docker-compose up -d
152
189
```
153
190
191
+
This will start QuestDB, Prometheus, and Grafana containers. You can access:
> A pre-configured Grafana dashboard for QuestDB metrics is included in the `questdb_dashboard.json` file, allowing for immediate visualization of your QuestDB instance's performance.
197
+
154
198
## Testing
155
199
156
200
Run the test suite using pytest:
@@ -165,4 +209,4 @@ Contributions are welcome! Please feel free to submit a Pull Request.
165
209
166
210
## License
167
211
168
-
This project is licensed under the [MIT License](LICENSE).
212
+
This project is licensed under the [MIT License](LICENSE).
0 commit comments