Skip to main content

ConnectorX status discussions Downloads

Load data from to , the fastest way.

ConnectorX enables you to load data from databases into Python in the fastest and most memory efficient way.

What you need is one line of code:

import connectorx as cx

cx.read_sql("postgresql://username:password@server:port/database", "SELECT * FROM lineitem")

Optionally, you can accelerate the data loading using parallelism by specifying a partition column.

import connectorx as cx

cx.read_sql("postgresql://username:password@server:port/database", "SELECT * FROM lineitem", partition_on="l_orderkey", partition_num=10)

The function will partition the query by evenly splitting the specified column to the amount of partitions. ConnectorX will assign one thread for each partition to load and write data in parallel. Currently, we support partitioning on numerical columns (cannot contain NULL) for SPJA queries.

Experimental: We are now providing federated query support, you can write a single query to join tables from two or more databases!

import connectorx as cx
db1 = "postgresql://username1:password1@server1:port1/database1"
db2 = "postgresql://username2:password2@server2:port2/database2"
cx.read_sql({"db1": db1, "db2": db2}, "SELECT * FROM db1.nation n, db2.region r where n.n_regionkey = r.r_regionkey")

By default, we pushdown all joins from the same data source. More details for setup and configuration can be found here.

Check out more detailed usage and examples here. A general introduction of the project can be found in this blog post.

Installation

pip install connectorx

Check out here to see how to build python wheel from source.

Performance

We compared different solutions in Python that provides the read_sql function, by loading a 10x TPC-H lineitem table (8.6GB) from Postgres into a DataFrame, with 4 cores parallelism.

Time chart, lower is better.

time chart

Memory consumption chart, lower is better.

memory chart

In conclusion, ConnectorX uses up to 3x less memory and 21x less time (3x less memory and 13x less time compared with Pandas.). More on here.

How does ConnectorX achieve a lightning speed while keeping the memory footprint low?

We observe that existing solutions more or less do data copy multiple times when downloading the data. Additionally, implementing a data intensive application in Python brings additional cost.

ConnectorX is written in Rust and follows "zero-copy" principle. This allows it to make full use of the CPU by becoming cache and branch predictor friendly. Moreover, the architecture of ConnectorX ensures the data will be copied exactly once, directly from the source to the destination.

How does ConnectorX download the data?

Upon receiving the query, e.g. SELECT * FROM lineitem, ConnectorX will first issue a LIMIT 1 query SELECT * FROM lineitem LIMIT 1 to get the schema of the result set.

Then, if partition_on is specified, ConnectorX will issue SELECT MIN($partition_on), MAX($partition_on) FROM (SELECT * FROM lineitem) to know the range of the partition column. After that, the original query is split into partitions based on the min/max information, e.g. SELECT * FROM (SELECT * FROM lineitem) WHERE $partition_on > 0 AND $partition_on < 10000. ConnectorX will then run a count query to get the partition size (e.g. SELECT COUNT(*) FROM (SELECT * FROM lineitem) WHERE $partition_on > 0 AND $partition_on < 10000). If the partition is not specified, the count query will be SELECT COUNT(*) FROM (SELECT * FROM lineitem).

Finally, ConnectorX will use the schema info as well as the count info to allocate memory and download data by executing the queries normally.

Once the downloading begins, there will be one thread for each partition so that the data are downloaded in parallel at the partition level. The thread will issue the query of the corresponding partition to the database and then write the returned data to the destination row-wise or column-wise (depends on the database) in a streaming fashion.

Supported Sources & Destinations

Example connection string, supported protocols and data types for each data source can be found here.

For more planned data sources, please check out our discussion.

Sources

  • Postgres
  • Mysql
  • Mariadb (through mysql protocol)
  • Sqlite
  • Redshift (through postgres protocol)
  • Clickhouse (through mysql protocol)
  • SQL Server
  • Azure SQL Database (through mssql protocol)
  • Oracle
  • Big Query
  • Trino
  • ODBC (WIP)
  • ...

Destinations

  • Pandas
  • PyArrow
  • Modin (through Pandas)
  • Dask (through Pandas)
  • Polars (through PyArrow)

Documentation

Doc: https://sfu-db.github.io/connector-x/intro.html Rust docs: stable nightly

Next Plan

Checkout our discussion to participate in deciding our next plan!

Historical Benchmark Results

https://sfu-db.github.io/connector-x/dev/bench/

Developer's Guide

Please see Developer's Guide for information about developing ConnectorX.

Supports

You are always welcomed to:

  1. Ask questions & propose new ideas in our github discussion.
  2. Ask questions in stackoverflow. Make sure to have #connectorx attached.

Organizations and Projects using ConnectorX

To add your project/organization here, reply our post here

Citing ConnectorX

If you use ConnectorX, please consider citing the following paper:

Xiaoying Wang, Weiyuan Wu, Jinze Wu, Yizhou Chen, Nick Zrymiak, Changbo Qu, Lampros Flokas, George Chow, Jiannan Wang, Tianzheng Wang, Eugene Wu, Qingqing Zhou. ConnectorX: Accelerating Data Loading From Databases to Dataframes. VLDB 2022.

BibTeX entry:

@article{connectorx2022,
  author    = {Xiaoying Wang and Weiyuan Wu and Jinze Wu and Yizhou Chen and Nick Zrymiak and Changbo Qu and Lampros Flokas and George Chow and Jiannan Wang and Tianzheng Wang and Eugene Wu and Qingqing Zhou},
  title     = {ConnectorX: Accelerating Data Loading From Databases to Dataframes},
  journal   = {Proc. {VLDB} Endow.},
  volume    = {15},
  number    = {11},
  pages     = {2994--3003},
  year      = {2022},
  url       = {https://www.vldb.org/pvldb/vol15/p2994-wang.pdf},
}

Contributors

wangxiaoying
Xiaoying Wang
dovahcrow
Weiyuan Wu
Wukkkinz-0725
Null
Yizhou150
Yizhou
zen-xu
ZhengYu, Xu
EricFecteau
EricFecteau
Jordan-M-Young
Jordan M. Young
AnatolyBuga
Anatoly Bugakov
wseaton
Will Eaton
domnikl
Dominik Liebler
auyer
Rafael Passos
pangjunrong
Pang Jun Rong (Jayden)
gruuya
Marko Grujic
jinzew
Null
alswang18
Alec Wang
lBilali
Lulzim Bilali
ritchie46
Ritchie Vink
houqp
QP Hou
wKollendorf
Null
CBQu
CbQu
quambene
Null
jorgecarleitao
Jorge Leitao
glennpierce
Glenn Pierce
alexander-beedie
Alexander Beedie
FerriLuli
FerriLuli
therealhieu
Hieu Minh Nguyen
JakkuSakura
Jakku Sakura
maxb2
Matthew Anderson
tschm
Thomas Schmelzer
MatsMoll
Mats Eikeland Mollestad
rursprung
Ralph Ursprung
albcunha
Null
kotval
Kotval
messense
Messense
phanindra-ramesh
Null
surister
Ivan
venkashank
Null
zemelLeong
zemel leong
zzzdong
Null
marianoguerra
Mariano Guerra
kevinheavey
Kevin Heavey
kayhoogland
Kay Hoogland
deepsourcebot
DeepSource Bot
bealdav
David Beal
AndrewJackson2020
Andrew Jackson
Cabbagec
Brandon
Amar1729
Amar Paul
aljazerzen
Aljaž Mur Eržen
aimtsou
Aimilios Tsouvelekakis

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

connectorx-0.4.1-cp313-none-win_amd64.whl (34.7 MB view details)

Uploaded CPython 3.13Windows x86-64

connectorx-0.4.1-cp313-cp313-manylinux_2_28_x86_64.whl (43.2 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.28+ x86-64

connectorx-0.4.1-cp313-cp313-macosx_11_0_arm64.whl (36.1 MB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

connectorx-0.4.1-cp313-cp313-macosx_10_7_x86_64.whl (37.9 MB view details)

Uploaded CPython 3.13macOS 10.7+ x86-64

connectorx-0.4.1-cp312-none-win_amd64.whl (34.7 MB view details)

Uploaded CPython 3.12Windows x86-64

connectorx-0.4.1-cp312-cp312-manylinux_2_28_x86_64.whl (43.3 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.28+ x86-64

connectorx-0.4.1-cp312-cp312-macosx_11_0_arm64.whl (36.1 MB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

connectorx-0.4.1-cp312-cp312-macosx_10_7_x86_64.whl (37.9 MB view details)

Uploaded CPython 3.12macOS 10.7+ x86-64

connectorx-0.4.1-cp311-none-win_amd64.whl (34.7 MB view details)

Uploaded CPython 3.11Windows x86-64

connectorx-0.4.1-cp311-cp311-manylinux_2_28_x86_64.whl (43.2 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.28+ x86-64

connectorx-0.4.1-cp311-cp311-macosx_11_0_arm64.whl (36.1 MB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

connectorx-0.4.1-cp311-cp311-macosx_10_7_x86_64.whl (37.9 MB view details)

Uploaded CPython 3.11macOS 10.7+ x86-64

connectorx-0.4.1-cp310-none-win_amd64.whl (34.7 MB view details)

Uploaded CPython 3.10Windows x86-64

connectorx-0.4.1-cp310-cp310-manylinux_2_28_x86_64.whl (43.2 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.28+ x86-64

connectorx-0.4.1-cp310-cp310-macosx_11_0_arm64.whl (36.1 MB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

connectorx-0.4.1-cp310-cp310-macosx_10_7_x86_64.whl (37.9 MB view details)

Uploaded CPython 3.10macOS 10.7+ x86-64

File details

Details for the file connectorx-0.4.1-cp313-none-win_amd64.whl.

File metadata

  • Download URL: connectorx-0.4.1-cp313-none-win_amd64.whl
  • Upload date:
  • Size: 34.7 MB
  • Tags: CPython 3.13, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.3

File hashes

Hashes for connectorx-0.4.1-cp313-none-win_amd64.whl
Algorithm Hash digest
SHA256 c09aa21bc339dfdeaf8f3d09b17ab10c71be2d32f2eb52e59f3c1647009b4d33
MD5 076abfbb7144a873245139c34429d53c
BLAKE2b-256 2c011eb04455bf38db2c3adeeff2f9ea59b8717feb5efaf69282ab72f16a0fd8

See more details on using hashes here.

File details

Details for the file connectorx-0.4.1-cp313-cp313-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for connectorx-0.4.1-cp313-cp313-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 907424f6ac194c20c9408ab94ffac72acefcdc93316dd69ad04d51316a027552
MD5 d9fdaa38ab3e53e522457d826028b9ab
BLAKE2b-256 cc7919962645defc7e15dec80c520288f3f17ce2c34881d16967cb426c495afd

See more details on using hashes here.

File details

Details for the file connectorx-0.4.1-cp313-cp313-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for connectorx-0.4.1-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 36686535aa0511fdd0d957d6d234169bb4101801f9d5da4a9b75de3507189c60
MD5 28c8f2c42cab8204c59d427fa6e7b2e1
BLAKE2b-256 11cd303d68a90cf05fdf82a7000a84183d56251c1b34c662e02eba65437e5b38

See more details on using hashes here.

File details

Details for the file connectorx-0.4.1-cp313-cp313-macosx_10_7_x86_64.whl.

File metadata

File hashes

Hashes for connectorx-0.4.1-cp313-cp313-macosx_10_7_x86_64.whl
Algorithm Hash digest
SHA256 331ae0f1cd8259d4fa93982f785d7f7e8c462a4c75af1a251584f4d6df630975
MD5 e5c27f67270748b7c7901cbec699a165
BLAKE2b-256 1049ab352f5ff63d7b61410b17ef3849a53e79b03b62abd16cd0c0027fea6d8b

See more details on using hashes here.

File details

Details for the file connectorx-0.4.1-cp312-none-win_amd64.whl.

File metadata

  • Download URL: connectorx-0.4.1-cp312-none-win_amd64.whl
  • Upload date:
  • Size: 34.7 MB
  • Tags: CPython 3.12, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.3

File hashes

Hashes for connectorx-0.4.1-cp312-none-win_amd64.whl
Algorithm Hash digest
SHA256 fd64156b8f6e14cc77f8e4ffe49b77fc4adea1414268433f032b5c91dc5f9e2f
MD5 54241885dfaec20e5b42459b755c7a6b
BLAKE2b-256 5246fdc6577596c59d2c7cb231a2e037107d873c1e8ff55f197af8c9a1dd09f8

See more details on using hashes here.

File details

Details for the file connectorx-0.4.1-cp312-cp312-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for connectorx-0.4.1-cp312-cp312-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 4159f6578a8b539bbbc3a4efd508b9ae38dad5e037f3349d3b5cbebfa7fa8e66
MD5 4de212f076e52030b0e5654d7d6d0d79
BLAKE2b-256 203fc67d7d4cb2f73495a4cedab9702c49c4a7cbffa860f4ede596014afbbbc7

See more details on using hashes here.

File details

Details for the file connectorx-0.4.1-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for connectorx-0.4.1-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 0bae0c076ce781ec06f9a7e18f0a4f575c754b9100238cc574e8edd221e10ec2
MD5 72de01edf6c4956b5c2e61e4b2c1976f
BLAKE2b-256 34430c50b6d5fd3e846d6ff21e7d4b6785488660fb55341565fd8751a1610d5e

See more details on using hashes here.

File details

Details for the file connectorx-0.4.1-cp312-cp312-macosx_10_7_x86_64.whl.

File metadata

File hashes

Hashes for connectorx-0.4.1-cp312-cp312-macosx_10_7_x86_64.whl
Algorithm Hash digest
SHA256 b23b108e2e7a361a058bd83b88cc677a9ef047ad1e9e7ff61a6771f4e6d9536a
MD5 24cb5ccbeace2c3cad08d7ed83862123
BLAKE2b-256 c28835c50622ce7a5d7d4d6fa4b6dadcae7ee807fff9fc9a9e712a278c76c26e

See more details on using hashes here.

File details

Details for the file connectorx-0.4.1-cp311-none-win_amd64.whl.

File metadata

  • Download URL: connectorx-0.4.1-cp311-none-win_amd64.whl
  • Upload date:
  • Size: 34.7 MB
  • Tags: CPython 3.11, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.3

File hashes

Hashes for connectorx-0.4.1-cp311-none-win_amd64.whl
Algorithm Hash digest
SHA256 8cd569b14fe84010989460fe5f46f1c65572dac898bed8c35c24106c4ce286bc
MD5 d108b8305a1c8db478939f325b3a8c61
BLAKE2b-256 7da9b2fe9fb1522a3e91e356e420b1981b36f45f917013907e0bb7057b272f2e

See more details on using hashes here.

File details

Details for the file connectorx-0.4.1-cp311-cp311-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for connectorx-0.4.1-cp311-cp311-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 80c0d4df06d0abd2cc8e037ab5a9160dcb808ef79df1b959b14b3f1708a4dc61
MD5 f22f23b165f15563c54df8021e2157f7
BLAKE2b-256 6e2584fc237dd89b6d9a29326be2e92081c2770b2e94133365a0c3fb0e27f906

See more details on using hashes here.

File details

Details for the file connectorx-0.4.1-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for connectorx-0.4.1-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 29cf23da07ac777335cce5552f8566e590e0aa431523795baffbe0060c36cfb0
MD5 0fd924a4a854f5301c5e946a02c51166
BLAKE2b-256 51366addae95faee1729f20b5547930ed847b2cc72f6f6733308fe6f1e472cec

See more details on using hashes here.

File details

Details for the file connectorx-0.4.1-cp311-cp311-macosx_10_7_x86_64.whl.

File metadata

File hashes

Hashes for connectorx-0.4.1-cp311-cp311-macosx_10_7_x86_64.whl
Algorithm Hash digest
SHA256 e11f6a41f7895a2b31aa769163b8884488f1ab6e4cf51c2624ca3713ae41e11e
MD5 7e48da8b349d59b4953feb3cc6b7c52e
BLAKE2b-256 2d74ede2994e6c6c41185b43a439f052343e0d21719c81eb6d01e5ff3b18a1ff

See more details on using hashes here.

File details

Details for the file connectorx-0.4.1-cp310-none-win_amd64.whl.

File metadata

  • Download URL: connectorx-0.4.1-cp310-none-win_amd64.whl
  • Upload date:
  • Size: 34.7 MB
  • Tags: CPython 3.10, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.3

File hashes

Hashes for connectorx-0.4.1-cp310-none-win_amd64.whl
Algorithm Hash digest
SHA256 50e86baff363632fbfcc92f01e97c01b8ea2cd49f476d80ffc32348367ef2caf
MD5 051bf049514584545d2e2004c6c8c304
BLAKE2b-256 ec4e26e9aca8604f3b8e62893e5c231d487b64f91b70ab5095bb69b9ec9f45fe

See more details on using hashes here.

File details

Details for the file connectorx-0.4.1-cp310-cp310-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for connectorx-0.4.1-cp310-cp310-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 03df70a1002c1535f54f90a513cf11e05fb2f137dbd054b630fd67a1e46f27ac
MD5 c2e83bc390bf661000a564c05cf3411f
BLAKE2b-256 1ac5e1269bde5d04570455fe7455c2b4f50062981c0f0817c45d8c63dc2ae0d9

See more details on using hashes here.

File details

Details for the file connectorx-0.4.1-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for connectorx-0.4.1-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 df400dff622a4622fd54696870d14b301682bccba4f44740f3445a6e206d5405
MD5 4105486ef5c66aa970d13430fb41d7b8
BLAKE2b-256 77ae536b768e194160a8992c5271e6d90fcdfafa7aecf98faea8326deb974833

See more details on using hashes here.

File details

Details for the file connectorx-0.4.1-cp310-cp310-macosx_10_7_x86_64.whl.

File metadata

File hashes

Hashes for connectorx-0.4.1-cp310-cp310-macosx_10_7_x86_64.whl
Algorithm Hash digest
SHA256 9c0be0a6d75d2973c85c659e47449a76023ead772882e696e39b4876aa35a162
MD5 10903566599692f9049f6c22bcca06a5
BLAKE2b-256 4423f98b910f067e58eeea044ce8ddc3ca6fa913c8667b99a7a9bae73876d553

See more details on using hashes here.

Release history Release notifications | RSS feed

0.4.5

25 files

0.4.4

20 files

0.4.3

20 files

0.4.2

16 files

This release

0.4.1 This release

16 files

0.4.0

16 files

0.3.3

16 files

0.3.2

16 files

0.3.1

16 files

0.3.0

16 files

0.2.5

16 files

0.2.4

12 files

0.2.3

13 files

0.2.2

12 files

0.2.1

9 files

0.2.0

9 files

0.1.1

9 files

0.1.0

9 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page