Inline SQL
An engine for inline SQL in any Python program.
import pandas as pd
from inline_sql import sql
def head_data(count: int) -> pd.DataFrame:
return sql << "SELECT * FROM 'cars.csv' LIMIT $count"
cars = head_data(50)
origin_counts = sql << """
SELECT origin, COUNT(*) FROM $cars
GROUP BY origin
ORDER BY count DESC
"""
print(origin_counts)
most_common = origin_counts.origin[0]
print(sql << """
SELECT AVG(horsepower) FROM $cars
WHERE origin = $most_common
""")
Operates directly on an in-memory database: access local variables (pandas frames), CSV files, and interpolate values into queries.
Table of Contents
Installation
pip install inline-sql
Contributions
Contributions are appreciated, especially in the following areas:
- Additional query engines
- File format support (CSV, Parquet, Arrow)
- Support for dataframe libraries (e.g., Polars)
- Distributed computing (Ray, Dask)
- Documentation
License
inline-sql is distributed under the terms of the MIT license.
Metadata
Release files for inline-sql 0.0.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| inline_sql-0.0.2.tar.gz | 3.0 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| inline_sql-0.0.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 6.0 kB
Release files / inline_sql-0.0.2.tar.gz
| Download URL | inline_sql-0.0.2.tar.gz |
|---|---|
| Size | 3.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
bd731a7532b84153cdb3de24016a1c730ee10683f7a0b1701e988d8c05019876
|
|
BLAKE2b-256 checksum How to use checksums |
8a57f6bfc42d426a1474e59a0566505ccb3f422cf165ea25e6519f01a0072e72
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
python-httpx/0.23.0
|
Release files / inline_sql-0.0.2-py3-none-any.whl
| Download URL | inline_sql-0.0.2-py3-none-any.whl |
|---|---|
| Size | 3.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
3368e49bd8a30ec0378200ca6b9403c81cc4641fd785babd97152b269ae96f9a
|
|
BLAKE2b-256 checksum How to use checksums |
7c8ba195d98f4ed0a05fbc5842848837148bea00d83be8df61a0def34b7b117a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
python-httpx/0.23.0
|