Skip to content

Commit cb8f4e1

Browse files
adjust index
1 parent cd418c7 commit cb8f4e1

File tree

1 file changed

+18
-16
lines changed
  • docs/integrations/language-clients/python

1 file changed

+18
-16
lines changed

docs/integrations/language-clients/python/index.md

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,37 @@
11
---
2-
sidebar_label: 'Python'
3-
sidebar_position: 10
2+
title: 'Python'
43
keywords: ['clickhouse', 'python', 'client', 'connect', 'integrate']
4+
description: 'Options for connecting to ClickHouse from Python'
55
slug: /integrations/python
66
description: 'The ClickHouse Connect project suite for connecting Python to ClickHouse'
77
title: 'Python Integration with ClickHouse Connect'
88
doc_type: 'guide'
99
---
1010

11-
import ConnectionDetails from '@site/docs/_snippets/_gather_your_details_http.mdx';
11+
import Tabs from '@theme/Tabs';
12+
import TabItem from '@theme/TabItem';
13+
import CodeBlock from '@theme/CodeBlock';
1214

13-
# Python Integration with ClickHouse Connect
15+
import ConnectionDetails from '@site/docs/_snippets/_gather_your_details_http.mdx';
1416

15-
## Introduction {#introduction}
17+
# Introduction {#introduction}
1618

1719
ClickHouse Connect is a core database driver providing interoperability with a wide range of Python applications.
1820

1921
- The main interface is the `Client` object in the package `clickhouse_connect.driver`. That core package also includes assorted helper classes and utility functions used for communicating with the ClickHouse server and "context" implementations for advanced management of insert and select queries.
2022
- The `clickhouse_connect.datatypes` package provides a base implementation and subclasses for all non-experimental ClickHouse datatypes. Its primary functionality is serialization and deserialization of ClickHouse data into the ClickHouse "Native" binary columnar format, used to achieve the most efficient transport between ClickHouse and client applications.
2123
- The Cython/C classes in the `clickhouse_connect.cdriver` package optimize some of the most common serializations and deserializations for significantly improved performance over pure Python.
2224
- There is a [SQLAlchemy](https://www.sqlalchemy.org/) dialect in the package `clickhouse_connect.cc_sqlalchemy` which is built off of the `datatypes` and `dbi` packages. This implementation supports SQLAlchemy Core functionality including `SELECT` queries with `JOIN`s (`INNER`, `LEFT OUTER`, `FULL OUTER`, `CROSS`), `WHERE` clauses, `ORDER BY`, `LIMIT`/`OFFSET`, `DISTINCT` operations, lightweight `DELETE` statements with `WHERE` conditions, table reflection, and basic DDL operations (`CREATE TABLE`, `CREATE`/`DROP DATABASE`). While it does not support advanced ORM features or advanced DDL features, it provides robust query capabilities suitable for most analytical workloads against ClickHouse's OLAP-oriented database.
23-
- The core driver and ClickHouse Connect SQLAlchemy implementation are the preferred method for connecting ClickHouse to Apache Superset. Use the `ClickHouse Connect` database connection, or `clickhousedb` SQLAlchemy dialect connection string.
25+
- The core driver and [ClickHouse Connect SQLAlchemy](sqlalchemy.md) implementation are the preferred method for connecting ClickHouse to Apache Superset. Use the `ClickHouse Connect` database connection, or `clickhousedb` SQLAlchemy dialect connection string.
2426

2527

26-
This documentation is current as of the beta release 0.9.3.
28+
This documentation is current as of the clickhouse-connect beta release 0.9.2.
2729

2830
:::note
2931
The official ClickHouse Connect Python driver uses the HTTP protocol for communication with the ClickHouse server. It has some advantages (such as better flexibility, HTTP load balancer support, and improved compatibility with JDBC-based tools) and disadvantages (such as slightly lower compression and performance, and a lack of support for some complex features of the native TCP-based protocol). For some use cases, you may consider using one of the [Community Python drivers](/interfaces/third-party/client-libraries.md) that use the native TCP-based protocol.
3032
:::
3133

32-
### Requirements and compatibility {#requirements-and-compatibility}
34+
## Requirements and compatibility {#requirements-and-compatibility}
3335

3436
| Python | | Platform¹ | | ClickHouse | | SQLAlchemy² | | Apache Superset | | Pandas | | Polars | |
3537
|-------------:|:--|----------------:|:--|----------------:|:---|------------:|:--|----------------:|:--|--------:|:--|-------:|:--|
@@ -44,13 +46,13 @@ The official ClickHouse Connect Python driver uses the HTTP protocol for communi
4446

4547
¹ClickHouse Connect has been explicitly tested against the listed platforms. In addition, untested binary wheels (with C optimization) are built for all architectures supported by the excellent [`cibuildwheel`](https://cibuildwheel.readthedocs.io/en/stable/) project. Finally, because ClickHouse Connect can also run as pure Python, the source installation should work on any recent Python installation.
4648

47-
²SQLAlchemy support is limited to Core functionality (queries, basic DDL). ORM features are not supported.
49+
²SQLAlchemy support is limited to Core functionality (queries, basic DDL). ORM features are not supported. See [SQLAlchemy Integration Support](sqlalchemy.md) docs for details.
4850

4951
³ClickHouse Connect generally works well with versions outside the officially supported range.
5052

51-
### Installation {#installation}
53+
## Installation {#installation}
5254

53-
Install ClickHouse Connect from PyPI via pip:
55+
Install ClickHouse Connect from [PyPI](https://pypi.org/project/clickhouse-connect/) via pip:
5456

5557
`pip install clickhouse-connect`
5658

@@ -59,17 +61,17 @@ ClickHouse Connect can also be installed from source:
5961
* (Optional) run `pip install cython` to build and enable the C/Cython optimizations
6062
* `cd` to the project root directory and run `pip install .`
6163

62-
### Support policy {#support-policy}
64+
## Support policy {#support-policy}
6365

6466
ClickHouse Connect is currently in beta and only the current beta release is actively supported. Please update to the latest version before reporting any issues. Issues should be filed in the [GitHub project](https://github.com/ClickHouse/clickhouse-connect/issues). Future releases of ClickHouse Connect are guaranteed to be compatible with actively supported ClickHouse versions at the time of release. ClickHouse Connect officially supports the current stable release and the two most recent LTS releases of ClickHouse server, matching ClickHouse's own [support policy](https://clickhouse.com/docs/knowledgebase/production#how-to-choose-between-clickhouse-releases). Our CI test matrix validates against the latest two LTS releases and the last three stable versions. Due to the HTTP protocol and minimal breaking changes between ClickHouse releases, ClickHouse Connect generally works well with versions outside the officially supported range, though compatibility with certain advanced data types may vary.
6567

66-
### Basic usage {#basic-usage}
68+
## Basic usage {#basic-usage}
6769

6870
### Gather your connection details {#gather-your-connection-details}
6971

7072
<ConnectionDetails />
7173

72-
#### Establish a connection {#establish-a-connection}
74+
### Establish a connection {#establish-a-connection}
7375

7476
There are two examples shown for connecting to ClickHouse:
7577
- Connecting to a ClickHouse server on localhost.
@@ -83,7 +85,7 @@ import clickhouse_connect
8385
client = clickhouse_connect.get_client(host='localhost', username='default', password='password')
8486
```
8587

86-
##### Use a ClickHouse Connect client instance to connect to a ClickHouse Cloud service: {#use-a-clickhouse-connect-client-instance-to-connect-to-a-clickhouse-cloud-service}
88+
#### Use a ClickHouse Connect client instance to connect to a ClickHouse Cloud service: {#use-a-clickhouse-connect-client-instance-to-connect-to-a-clickhouse-cloud-service}
8789

8890
:::tip
8991
Use the connection details gathered earlier. ClickHouse Cloud services require TLS, so use port 8443.
@@ -95,7 +97,7 @@ import clickhouse_connect
9597
client = clickhouse_connect.get_client(host='HOSTNAME.clickhouse.cloud', port=8443, username='default', password='your password')
9698
```
9799

98-
#### Interact with your database {#interact-with-your-database}
100+
### Interact with your database {#interact-with-your-database}
99101

100102
To run a ClickHouse SQL command, use the client `command` method:
101103

0 commit comments

Comments
 (0)