2
2
Using CrateDB with turbodbc
3
3
###########################
4
4
5
+ This document and its accompanying code example describes how to connect
6
+ to `CrateDB `_ using `turbodbc `_.
5
7
6
- *****
7
- About
8
- *****
9
-
10
- This section of the documentation describes how to connect to `CrateDB `_
11
- with `turbodbc `_, by providing a few example programs.
12
-
13
- The examples use the `unixODBC `_ implementation of `ODBC `_, and the `PostgreSQL
8
+ The example uses the `unixODBC `_ implementation of `ODBC `_, and the `PostgreSQL
14
9
ODBC driver `_, for connecting to the `PostgreSQL wire protocol `_ interface of
15
10
`CrateDB `_.
16
11
17
- This folder also contains ``Dockerfile `` files providing environments to
18
- exercise the examples on different operating systems, like Arch Linux,
19
- Red Hat (CentOS), Debian, and SUSE Linux.
20
-
21
-
22
12
************
23
13
Introduction
24
14
************
@@ -77,35 +67,28 @@ Setup
77
67
Install prerequisites
78
68
=====================
79
69
80
- Arch Linux::
81
-
82
- # See `dockerfiles/archlinux.Dockerfile`.
83
-
84
- CentOS Stream::
85
-
86
- dnf install --enablerepo=crb -y boost-devel g++ postgresql-odbc python3 python3-devel python3-pip unixODBC-devel
87
-
88
- Debian::
89
-
90
- apt-get install --yes build-essential libboost-dev odbc-postgresql unixodbc-dev
91
-
92
70
macOS/Homebrew::
93
71
94
- brew install psqlodbc unixodbc
72
+ brew install psqlodbc pybind11 simdutf unixodbc
95
73
96
- SUSE Linux Enterprise Server::
74
+ If you can't install the required software components on your machine,
75
+ head over to the `README-OCI `_ document.
97
76
98
- # See `dockerfiles/sles.Dockerfile`.
77
+ This folder also contains ``Dockerfile `` files providing environments to
78
+ exercise the code example on different operating systems, like Arch Linux,
79
+ Red Hat (CentOS), Debian, and SUSE Linux.
99
80
100
81
Install Python sandbox
101
82
======================
102
- ::
83
+ Create Python virtualenv and install dependency packages ::
103
84
104
- # Create Python virtualenv and install dependency packages.
105
- python3 -m venv .venv
85
+ uv venv --python 3.12 --seed
106
86
source .venv/bin/activate
107
- pip install --upgrade --requirement=requirements-prereq.txt
108
- pip install --upgrade --requirement=requirements.txt --verbose
87
+ uv pip install --upgrade --verbose \
88
+ --requirement=requirements-prereq.txt
89
+ uv pip install --upgrade --verbose \
90
+ --requirement=requirements-dev.txt \
91
+ --requirement=requirements.txt
109
92
110
93
.. note ::
111
94
@@ -125,21 +108,11 @@ Usage
125
108
Run CrateDB::
126
109
127
110
docker run --rm -it --publish=4200:4200 --publish=5432:5432 crate \
128
- -Cdiscovery.type=single-node -Ccluster.routing.allocation.disk.threshold_enabled=false
129
-
130
- Invoke demo program on workstation::
131
-
132
- python demo.py
133
-
134
- Exercise demo program using Docker, on different operating systems::
135
-
136
- docker build --progress=plain --tag local/python-turbodbc-demo --file=dockerfiles/archlinux.Dockerfile .
137
- docker build --progress=plain --tag local/python-turbodbc-demo --file=dockerfiles/centos.Dockerfile .
138
- docker build --progress=plain --tag local/python-turbodbc-demo --file=dockerfiles/debian.Dockerfile .
139
- docker build --progress=plain --tag local/python-turbodbc-demo --file=dockerfiles/sles.Dockerfile .
111
+ -Cdiscovery.type=single-node
140
112
141
- docker run --rm -it --volume=$(pwd):/src --network=host local/python-turbodbc- demo python3 /src/demo.py
113
+ Invoke demo program::
142
114
115
+ python demo.py
143
116
144
117
*******
145
118
Backlog
@@ -152,10 +125,11 @@ examples to be exercised are tracked within the `backlog`_.
152
125
153
126
.. _Apache Arrow : https://en.wikipedia.org/wiki/Apache_Arrow
154
127
.. _Apache Arrow support : https://turbodbc.readthedocs.io/en/latest/pages/advanced_usage.html#advanced-usage-arrow
155
- .. _backlog : https://github.com/crate/cratedb-examples/blob/main/python-turbodbc/backlog.rst
156
- .. _CrateDB : https://github .com/crate/crate
128
+ .. _backlog : https://github.com/crate/cratedb-examples/blob/main/by-language/ python-turbodbc/backlog.rst
129
+ .. _CrateDB : https://cratedb .com/database
157
130
.. _NumPy : https://en.wikipedia.org/wiki/NumPy
158
131
.. _NumPy support : https://turbodbc.readthedocs.io/en/latest/pages/advanced_usage.html#advanced-usage-numpy
132
+ .. _README-OCI : ./README-OCI.md
159
133
.. _ODBC : https://en.wikipedia.org/wiki/Open_Database_Connectivity
160
134
.. _Open Database Connectivity (ODBC) : https://en.wikipedia.org/wiki/Open_Database_Connectivity
161
135
.. _PostgreSQL ODBC driver : https://odbc.postgresql.org/
0 commit comments