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
EricFecteau
EricFecteau
zen-xu
ZhengYu, Xu
domnikl
Dominik Liebler
wseaton
Will Eaton
AnatolyBuga
Anatoly Bugakov
Jordan-M-Young
Jordan M. Young
jsjasonseba
Jason
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
marianoguerra
Mariano Guerra
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
kevinheavey
Kevin Heavey
kayhoogland
Kay Hoogland
DeflateAwning
DeflateAwning
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.2-cp313-none-win_amd64.whl (32.4 MB view details)

Uploaded CPython 3.13Windows x86-64

connectorx-0.4.2-cp313-cp313-manylinux_2_28_x86_64.whl (40.7 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.28+ x86-64

connectorx-0.4.2-cp313-cp313-macosx_11_0_arm64.whl (33.7 MB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

connectorx-0.4.2-cp313-cp313-macosx_10_7_x86_64.whl (35.5 MB view details)

Uploaded CPython 3.13macOS 10.7+ x86-64

connectorx-0.4.2-cp312-none-win_amd64.whl (32.4 MB view details)

Uploaded CPython 3.12Windows x86-64

connectorx-0.4.2-cp312-cp312-manylinux_2_28_x86_64.whl (40.7 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.28+ x86-64

connectorx-0.4.2-cp312-cp312-macosx_11_0_arm64.whl (33.7 MB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

connectorx-0.4.2-cp312-cp312-macosx_10_7_x86_64.whl (35.5 MB view details)

Uploaded CPython 3.12macOS 10.7+ x86-64

connectorx-0.4.2-cp311-none-win_amd64.whl (32.4 MB view details)

Uploaded CPython 3.11Windows x86-64

connectorx-0.4.2-cp311-cp311-manylinux_2_28_x86_64.whl (40.7 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.28+ x86-64

connectorx-0.4.2-cp311-cp311-macosx_11_0_arm64.whl (33.7 MB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

connectorx-0.4.2-cp311-cp311-macosx_10_7_x86_64.whl (35.5 MB view details)

Uploaded CPython 3.11macOS 10.7+ x86-64

connectorx-0.4.2-cp310-none-win_amd64.whl (32.4 MB view details)

Uploaded CPython 3.10Windows x86-64

connectorx-0.4.2-cp310-cp310-manylinux_2_28_x86_64.whl (40.7 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.28+ x86-64

connectorx-0.4.2-cp310-cp310-macosx_11_0_arm64.whl (33.7 MB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

connectorx-0.4.2-cp310-cp310-macosx_10_7_x86_64.whl (35.5 MB view details)

Uploaded CPython 3.10macOS 10.7+ x86-64

File details

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

File metadata

  • Download URL: connectorx-0.4.2-cp313-none-win_amd64.whl
  • Upload date:
  • Size: 32.4 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.2-cp313-none-win_amd64.whl
Algorithm Hash digest
SHA256 c33245810eac8abad05d6d089b89584013b8e03ac6f02dd50fb3655123eefa7b
MD5 f694f1a9a6dd067942dcf5b2ef9d2b3c
BLAKE2b-256 3c45c368b4a6c4cf05666911714fd7b485d5035bd5f73e0ceb8497b61034230c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for connectorx-0.4.2-cp313-cp313-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 b337b44740fb68caff4c3c3ae667c09939ab9e5a2920ca675d9726f2321b8b9b
MD5 821400a7404e75adc0f0a18c3699a128
BLAKE2b-256 bf272190fa12d29996298869276e3082ec63eb75216fdaac74aa150731174c10

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for connectorx-0.4.2-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 e6bdef6046a7e41de6fe1282024bb990a40281d1e104b803d82a928a443bb49a
MD5 9a4f26c6ac9ea0ea3df9fc47c7955852
BLAKE2b-256 e681d6414fe8d22aa483bdadadd4d3f541065aea301839b308663590a014bde7

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for connectorx-0.4.2-cp313-cp313-macosx_10_7_x86_64.whl
Algorithm Hash digest
SHA256 190bb9426bd46acb22d98ddaa7c362474338557f72e9c8fcf0a998d7aecb0ef5
MD5 af3c90bf69308acdc98b558deb620f74
BLAKE2b-256 91d92a91fcfae08a763b8e57eaeaf6d87322009df0f8db84cc62a105b255c3ea

See more details on using hashes here.

File details

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

File metadata

  • Download URL: connectorx-0.4.2-cp312-none-win_amd64.whl
  • Upload date:
  • Size: 32.4 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.2-cp312-none-win_amd64.whl
Algorithm Hash digest
SHA256 ff3fad383d95fd3b8b45a9156895172cbed9f622ee9e957294df4ec22e3fe34c
MD5 e2b968ebf55ba0915bd82eea3ab33df3
BLAKE2b-256 270c4b88bac7f926ca74e960b607362440911e477d502dcb522311ac3939045e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for connectorx-0.4.2-cp312-cp312-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 61ff8b1d4d9fa80f246e6874f89221f64d6a8a8723cbbb4ac83ff1417416a0e4
MD5 47a417e860c4b32fd51476bb635651d3
BLAKE2b-256 b177062aaf55c39b7eeb7f88b350ffb46e6e27247e09be6a551b68f201febba5

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for connectorx-0.4.2-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 0f2eb4d52552f2d660ad8803243015b35869b705db6b4d560874850b9699e6ed
MD5 a9c34ae4a16a67b408596cec533bbe3a
BLAKE2b-256 85e43e9aaa43a739a2e1e25902f303538ba119a72e900a39f94a1b261479aa71

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for connectorx-0.4.2-cp312-cp312-macosx_10_7_x86_64.whl
Algorithm Hash digest
SHA256 0e23c5afcfba05cf841d5cca3f5bced4962be428eff50aefbdaa31778c7280c0
MD5 d3c599a3d88466bfb34e0c409f4eeccd
BLAKE2b-256 b9764038009d2765d3c1c347d41e065480f84076c03bf22236baa59942efc5bd

See more details on using hashes here.

File details

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

File metadata

  • Download URL: connectorx-0.4.2-cp311-none-win_amd64.whl
  • Upload date:
  • Size: 32.4 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.2-cp311-none-win_amd64.whl
Algorithm Hash digest
SHA256 1896d86d2397c1205a0d6adb2d8fbabc5fa0cc953a973c587c410efd04b1d09a
MD5 4f31fc4de812a8c6d20c89b2ab5c3441
BLAKE2b-256 ee270d670ef66a6af77ffc1d310d51b658a84442e82b6b2b394084d0fe30a370

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for connectorx-0.4.2-cp311-cp311-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 327dd33f11fa75e7c48195bea1702aafd0f59173d5798c8c9e2c487a7e0ebd98
MD5 b241549ae0ce53d11d923e98240dd0ec
BLAKE2b-256 6d97c7f5d64e0f2ba4dd36e9692d67d513daab6e2cada67588c2c5a3587dad89

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for connectorx-0.4.2-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 5e7c8c0b8fd6b1a1e341c873256d995cd255fedfec6b84c79c0e89864866e75f
MD5 c78919e6387e4c6861031e68c8e5aa47
BLAKE2b-256 ce9d57ff9c115b750d3a300bb67e192aa4d4a6f508f4597c45843e8aef1047b2

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for connectorx-0.4.2-cp311-cp311-macosx_10_7_x86_64.whl
Algorithm Hash digest
SHA256 22415c1dc6efb132409822f91ab90111535a507560b616f5bf1f88a64ae9c046
MD5 6ff878ef9190b2722003d4bd2f1fe54a
BLAKE2b-256 2f93546de30f48b80779e9b59600116e6149cfc9d69a424966de17eee9a9641e

See more details on using hashes here.

File details

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

File metadata

  • Download URL: connectorx-0.4.2-cp310-none-win_amd64.whl
  • Upload date:
  • Size: 32.4 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.2-cp310-none-win_amd64.whl
Algorithm Hash digest
SHA256 05933ef59456786d0428d4d3e201579cedc8e09338ef44cd7f82ddf4ffad4c08
MD5 a90792177233f43cc6dac05c0b32c8ab
BLAKE2b-256 e0063fa984e89b4ba7c4d95570e43eb56b762b2220b3c0c3730fadf74e222380

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for connectorx-0.4.2-cp310-cp310-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 90673abfc30bc540088fd08e4e9b9c50a6ab85044609a1556c9f8905f4aed895
MD5 6cb97bd4b33241cdadbdf889c01da385
BLAKE2b-256 080f7d6be0d97476d7fe2850c5aea43a2720419518b72a4fe3e2d02779890fbb

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for connectorx-0.4.2-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 ed234727049008c5bfa4a956714fff874cc210f03bfa1ac3e2dbe6a21128d497
MD5 f14b5a87cb52506b080f6b035b3c7de0
BLAKE2b-256 ce957c64d8707d7b3bf89b10b2a83ec60992da16e6b067281bfe78770c0fbd14

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for connectorx-0.4.2-cp310-cp310-macosx_10_7_x86_64.whl
Algorithm Hash digest
SHA256 fcb1dc988efbb2491375b36024a0123e8316f494bac3d4704ed6bd9eaf2df03c
MD5 749ff98e3363d965802cbd8846ceb923
BLAKE2b-256 217ecbf49bc18bffab2a56ee1fe403ffb16a3ca020603de9b5873571b003c247

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

This release

0.4.2 This release

16 files

0.4.1

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