Skip to content

Commit 25923a7

Browse files
committed
mention how to run streaming sql via timeplus-connect
1 parent e5f4a57 commit 25923a7

File tree

1 file changed

+17
-2
lines changed

1 file changed

+17
-2
lines changed

docs/timeplus-connect.md

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
# timeplus-connect (Python)
22

3-
`timeplus-connect` is the recommended Python library to connect to Timeplus Proton and Timeplus Enterprise. It's a high performance database driver for connecting Timeplus to Python, Pandas, and Superset
3+
`timeplus-connect` is the recommended Python library to connect to Timeplus Proton and Timeplus Enterprise. It's a high performance database driver for connecting Timeplus to Python, Pandas, and Superset
44
* Pandas DataFrames
55
* Numpy Arrays
66
* PyArrow Tables
77
* Superset Connector
88
* SQLAlchemy 1.3 and 1.4 (limited feature set)
99

10-
Timeplus Connect currently uses the Timeplus HTTP interface for maximum compatibility, defaulting to 8123.
10+
Timeplus Connect currently uses the Timeplus HTTP interface for maximum compatibility, defaulting to 8123 (batch query). You can also use 3218 port for [streaming queries](#streaming-query).
1111

1212
The source code and latest releases are available on [GitHub](https://github.com/timeplus-io/timeplus-connect).
1313

@@ -18,6 +18,21 @@ pip install timeplus-connect
1818
```
1919
Timeplus Connect requires Python 3.9 or higher.
2020

21+
## Streaming Query
22+
The SQLAlchemy or DBAPI don't support streaming queries. You can use the low level HTTP client interface to perform streaming queries.
23+
24+
```python
25+
client=timeplus_connect.get_client(
26+
host="timeplus_host",
27+
port=3218, # make sure to use 3218 port for streaming query
28+
username="timeplus", # for Timeplus Proton, username=default, and password is an empty string
29+
password=os.environ.get("PWD"),
30+
)
31+
with client.query_arrow_stream('select ..') as _stream:
32+
for _batch in _stream:
33+
_batch.to_pandas()
34+
```
35+
2136
## SQLAlchemy Implementation
2237
Timeplus Connect incorporates a minimal SQLAlchemy implementation (without any ORM features) for compatibility with Superset. It has only been tested against SQLAlchemy versions 1.3.x and 1.4.x, and is unlikely to work with more complex SQLAlchemy applications.
2338

0 commit comments

Comments
 (0)