<div align="center">
<img src="./assets/xorbits-logo.png" width="180px" alt="xorbits" />
# Xorbits SQL: made pandas and SQL APIs work seamlessly together
[![PyPI Latest Release](https://img.shields.io/pypi/v/xorbits_sql.svg?style=for-the-badge)](https://pypi.org/project/xorbits_sql/)
[![License](https://img.shields.io/pypi/l/xorbits_sql.svg?style=for-the-badge)](https://github.com/xorbitsai/xorbits_sql/blob/main/LICENSE)
[![Build Status](https://img.shields.io/github/actions/workflow/status/xorbitsai/xorbits_sql/python.yaml?branch=main&style=for-the-badge&label=GITHUB%20ACTIONS&logo=github)](https://actions-badge.atrox.dev/xorbitsai/xorbits_sql/goto?ref=main)
[![Slack](https://img.shields.io/badge/join_Slack-781FF5.svg?logo=slack&style=for-the-badge)](https://join.slack.com/t/xorbitsio/shared_invite/zt-1o3z9ucdh-RbfhbPVpx7prOVdM1CAuxg)
[![Twitter](https://img.shields.io/twitter/follow/xorbitsio?logo=twitter&style=for-the-badge)](https://twitter.com/xorbitsio)
Xorbits SQL provides a SQL interface built on [Xorbits](https://github.com/xorbitsai/xorbits),
allowing you to fluidly combine pandas and SQL to solve problems using the most familiar interface.
</div>
<br />
<div align="center">
<i><a href="https://join.slack.com/t/xorbitsio/shared_invite/zt-1z3zsm9ep-87yI9YZ_B79HLB2ccTq4WA">👉 Join our Slack community!</a></i>
</div>
**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](https://github.com/tobymao/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
```bash
$ pip install "xorbits_sql"
```
### Quick Start
Xorbits SQL provides a single API `execute()` which will return an Xorbits DataFrame.
```python
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](LICENSE)
Raw data
{
"_id": null,
"home_page": "http://github.com/xorbitsai/xorbits_sql",
"name": "xorbits-sql",
"maintainer": "Qin Xuye",
"docs_url": null,
"requires_python": "",
"maintainer_email": "qinxuye@xprobe.io",
"keywords": "",
"author": "Qin Xuye",
"author_email": "qinxuye@xprobe.io",
"download_url": "https://files.pythonhosted.org/packages/0a/44/861f49be5317a33a2d352db31e4507ef84a9a9d4511515788b78946e0f7a/xorbits_sql-0.0.1.tar.gz",
"platform": null,
"description": "<div align=\"center\">\n<img src=\"./assets/xorbits-logo.png\" width=\"180px\" alt=\"xorbits\" />\n\n# Xorbits SQL: made pandas and SQL APIs work seamlessly together\n\n[![PyPI Latest Release](https://img.shields.io/pypi/v/xorbits_sql.svg?style=for-the-badge)](https://pypi.org/project/xorbits_sql/)\n[![License](https://img.shields.io/pypi/l/xorbits_sql.svg?style=for-the-badge)](https://github.com/xorbitsai/xorbits_sql/blob/main/LICENSE)\n[![Build Status](https://img.shields.io/github/actions/workflow/status/xorbitsai/xorbits_sql/python.yaml?branch=main&style=for-the-badge&label=GITHUB%20ACTIONS&logo=github)](https://actions-badge.atrox.dev/xorbitsai/xorbits_sql/goto?ref=main)\n[![Slack](https://img.shields.io/badge/join_Slack-781FF5.svg?logo=slack&style=for-the-badge)](https://join.slack.com/t/xorbitsio/shared_invite/zt-1o3z9ucdh-RbfhbPVpx7prOVdM1CAuxg)\n[![Twitter](https://img.shields.io/twitter/follow/xorbitsio?logo=twitter&style=for-the-badge)](https://twitter.com/xorbitsio)\n\nXorbits SQL provides a SQL interface built on [Xorbits](https://github.com/xorbitsai/xorbits), \nallowing you to fluidly combine pandas and SQL to solve problems using the most familiar interface.\n</div>\n<br />\n\n<div align=\"center\">\n<i><a href=\"https://join.slack.com/t/xorbitsio/shared_invite/zt-1z3zsm9ep-87yI9YZ_B79HLB2ccTq4WA\">\ud83d\udc49 Join our Slack community!</a></i>\n</div>\n\n**Xorbits SQL is still at an early development stage and under active improvement. \nPlease feel free to provide feedback if you encounter any issues or have any suggestion.**\n\n## Key features\n\n\ud83c\udf1f **Pandas and SQL APIs in one**: The popular pandas and SQL APIs now work seamlessly together.\n\n\u26a1\ufe0f**Out-of-core and distributed capabilities**: Thanks to the underlying Xorbits execution engine, \nout-of-core and distributed runtimes are natively supported.\n\n\ud83d\udd0c **Mainstream SQL dialects compatible**: By leveraging [SQLGlot](https://github.com/tobymao/sqlglot) as the SQL parser, \nXorbits SQL is compatible with many dialects including DuckDB, Presto, Spark, Snowflake, and BigQuery.\n\n## Getting Started\nXorbits SQL can be installed via pip from PyPI. It is highly recommended to create a new virtual\nenvironment to avoid conflicts.\n\n### Installation\n```bash\n$ pip install \"xorbits_sql\"\n```\n\n### Quick Start\n\nXorbits SQL provides a single API `execute()` which will return an Xorbits DataFrame.\n\n```python\nimport xorbits.pandas as pd\nimport xorbits_sql as xsql\n\ndf = pd.DataFrame({\"a\": [1, 2, 3], \"b\": ['a', 'b', 'a']})\n# SQL\nsql = \"\"\"\nselect b, AVG(a) as result\nfrom t\ngroup by b\n\"\"\"\ndf2 = xsql.execute(\n sql,\n dialect=None, # optional, replace with SQL dialect, e.g. \"duckdb\"\n tables={'t': df} # register table, table name to Xorbits DataFrame\n)\nprint(df2)\n```\n\n## License\n[Apache 2](LICENSE)\n\n\n",
"bugtrack_url": null,
"license": "Apache License 2.0",
"summary": "Run SQL queries freely on Xorbits.",
"version": "0.0.1",
"project_urls": {
"Homepage": "http://github.com/xorbitsai/xorbits_sql"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "473884cd13c1265ad85a47356803b9fbaec67c58402f1eb4f2901d1873d0833c",
"md5": "4b8d13451a29eb44c59d80f996889019",
"sha256": "5dee50d5a990b8bed54a5df540b5ba13ce96508571df6fd0712d638450208169"
},
"downloads": -1,
"filename": "xorbits_sql-0.0.1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "4b8d13451a29eb44c59d80f996889019",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 22126,
"upload_time": "2023-09-04T13:09:42",
"upload_time_iso_8601": "2023-09-04T13:09:42.365300Z",
"url": "https://files.pythonhosted.org/packages/47/38/84cd13c1265ad85a47356803b9fbaec67c58402f1eb4f2901d1873d0833c/xorbits_sql-0.0.1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "0a44861f49be5317a33a2d352db31e4507ef84a9a9d4511515788b78946e0f7a",
"md5": "8cd2d8f3e147fa3acc12cc72b161f030",
"sha256": "d8ca50071703c1f34c5fdf4372545e206ad1459cd08257fa7b3c521cf0469df6"
},
"downloads": -1,
"filename": "xorbits_sql-0.0.1.tar.gz",
"has_sig": false,
"md5_digest": "8cd2d8f3e147fa3acc12cc72b161f030",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 20769,
"upload_time": "2023-09-04T13:09:43",
"upload_time_iso_8601": "2023-09-04T13:09:43.594111Z",
"url": "https://files.pythonhosted.org/packages/0a/44/861f49be5317a33a2d352db31e4507ef84a9a9d4511515788b78946e0f7a/xorbits_sql-0.0.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-09-04 13:09:43",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "xorbitsai",
"github_project": "xorbits_sql",
"github_not_found": true,
"lcname": "xorbits-sql"
}