Skip to content

Latest commit

 

History

History
67 lines (51 loc) · 2.7 KB

README.md

File metadata and controls

67 lines (51 loc) · 2.7 KB
xorbits

Xorbits SQL: made pandas and SQL APIs work seamlessly together

PyPI Latest Release License Build Status Slack Twitter

Xorbits SQL provides a SQL interface built on Xorbits, allowing you to fluidly combine pandas and SQL to solve problems using the most familiar interface.


Xorbits SQL is still at an early development stage and under active improvement. Please feel free to provide feedback if you encounter any issues or have any suggestion.

Key features

🌟 Pandas and SQL APIs in one: The popular pandas and SQL APIs now work seamlessly together.

⚡️Out-of-core and distributed capabilities: Thanks to the underlying Xorbits execution engine, out-of-core and distributed runtimes are natively supported.

🔌 Mainstream SQL dialects compatible: By leveraging SQLGlot as the SQL parser, Xorbits SQL is compatible with many dialects including DuckDB, Presto, Spark, Snowflake, and BigQuery.

Getting Started

Xorbits SQL can be installed via pip from PyPI. It is highly recommended to create a new virtual environment to avoid conflicts.

Installation

$ pip install "xorbits-sql"

Quick Start

Xorbits SQL provides a single API execute() which will return an Xorbits DataFrame.

import xorbits.pandas as pd
import xorbits_sql as xsql

df = pd.DataFrame({"a": [1, 2, 3], "b": ['a', 'b', 'a']})
# SQL
sql = """
select b, AVG(a) as result
from t
group by b
"""
df2 = xsql.execute(
    sql,
    dialect=None,     # optional, replace with SQL dialect, e.g. "duckdb"
    tables={'t': df}  # register table, table name to Xorbits DataFrame
)
print(df2)

License

Apache 2