Skip to main content

SQC

SQL Queries to Collections

Examples

from sqc import sqc

data = [
    {"a": 1, "b": 1},
    {"a": 2, "b": 1},
    {"a": 3, "b": 2},
]

Simple filtering

query = sqc("SELECT b WHERE a = 2")
reset = query.execute(data)
assert result == [{"b": 1}]

Roadmap:

Named data source:

query = sqc("SELECT b FROM table WHERE a < 2")
reset = query.execute(table=data)
assert result == [{"b": 1}]

Attribute access:

from typing import NamedTuple

class Row(NamedTuple):
    a: int
    b: int

query = sqc("SELECT b WHERE a < 2", field_getter=getattr)
assert isinstance(query, SqcQuery)
reset = query.execute(map(Row._make, data))
assert result == [{"b": 1}]

Nested data structures:

query = sqc("SELECT path(a, 'c[a].b[0]') AS q, c WHERE b > 1")

Custom output structure:

query = sqc("SELECT b WHERE a < 2", output=tuple)
reset = query.execute(data)
assert result == [(1,)]

Shortcuts:

query = sqc("SELECT b WHERE a < 2")
assert query.one(data) = (1,)
assert query.scalar(data) == 1

Metadata

Release files for sqc 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for sqc 0.1.0
File Size Uploaded Provenance Actions
sqc-0.1.0.tar.gz 3.3 kB Without provenance Details for sqc-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for sqc 0.1.0
File Interpreter ABI Platform Actions
sqc-0.1.0-py2.py3-none-any.whl Python 3, Python 2 none any Details for sqc-0.1.0-py2.py3-none-any.whl

Total release size: 6.7 kB

Release files / sqc-0.1.0.tar.gz

Download URL sqc-0.1.0.tar.gz
Size 3.3 kB
Tags Source
SHA-256 checksum
How to use checksums
d2f22aa0b06babcf322fc656b3ab195a5796cd5ceda5621a391fe27f5101afcc
BLAKE2b-256 checksum
How to use checksums
068558cad4ee02044ef9a1dea1f0a1e59bf4ca3c02750710d3b61440686c145c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via python-requests/2.26.0

Release files / sqc-0.1.0-py2.py3-none-any.whl

Download URL sqc-0.1.0-py2.py3-none-any.whl
Size 3.5 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
ca261927ece519566801ccb589e19c0eab42c60f447693b1271794facefba23d
BLAKE2b-256 checksum
How to use checksums
21257a9d5cad9054017ac924dc151c07b9311efdd11fae19bcc2844bbdb83a41
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via python-requests/2.26.0

Security for sqc 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files No provenance

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