Skip to content

Commit 3d7f82e

Browse files
committed
Driver/ODBC: Add Python (turbodbc)
1 parent 866a71f commit 3d7f82e

File tree

1 file changed

+39
-0
lines changed

1 file changed

+39
-0
lines changed

docs/connect/odbc/index.md

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,44 @@ cursor.close()
115115
connection.close()
116116
```
117117

118+
### Python (turbodbc)
119+
120+
[turbodbc] is a Python module to access relational databases via the Open
121+
Database Connectivity (ODBC) interface. turbodbc offers built-in NumPy and
122+
Apache Arrow for maximum performance.
123+
124+
```shell
125+
pip install --upgrade turbodbc
126+
```
127+
```python
128+
import turbodbc
129+
130+
# Connect to database
131+
connection_string = \
132+
"Driver={PostgreSQL ODBC};Server=localhost;Port=5432;" \
133+
"Uid=crate;Pwd=crate;Database=doc;MaxVarcharSize=1073741824"
134+
connection = turbodbc.connect(connection_string)
135+
136+
# Invoke query
137+
cursor = connection.cursor()
138+
cursor.execute("SELECT * FROM sys.summits ORDER BY height DESC LIMIT 5")
139+
140+
# Display results
141+
for row in cursor:
142+
print(row)
143+
144+
# Clean up
145+
cursor.close()
146+
connection.close()
147+
```
148+
149+
:::{todo}
150+
Enable with the [Python patch](https://github.com/crate/cratedb-guide/pull/403).
151+
```
152+
- {ref}`Turbodbc -- a high-performance ODBC library <turbodbc>`
153+
```
154+
:::
155+
118156
### Visual Basic
119157

120158
See also [psqlODBC with Visual Basic]. Please navigate to the
@@ -156,3 +194,4 @@ cn.Close
156194
[pyodbc]: https://github.com/mkleehammer/pyodbc
157195
[pyodbc installation instructions]: https://github.com/mkleehammer/pyodbc/wiki/Install
158196
[System.Data.Odbc]: https://learn.microsoft.com/en-us/dotnet/api/system.data.odbc
197+
[turbodbc]: https://turbodbc.readthedocs.io/

0 commit comments

Comments
 (0)