{"id":39137937,"url":"https://github.com/uplol/qwery","last_synced_at":"2026-01-17T21:27:32.223Z","repository":{"id":50964272,"uuid":"264340605","full_name":"uplol/qwery","owner":"uplol","description":"qwery is a small and lightweight query builder and data layer based on Pydantic and asyncpg","archived":false,"fork":false,"pushed_at":"2021-08-21T07:32:55.000Z","size":53,"stargazers_count":17,"open_issues_count":1,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-09-06T12:52:01.015Z","etag":null,"topics":["postgresql","query-builder","sql"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/uplol.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-05-16T02:12:41.000Z","updated_at":"2024-12-31T08:37:05.000Z","dependencies_parsed_at":"2022-09-02T07:01:30.711Z","dependency_job_id":null,"html_url":"https://github.com/uplol/qwery","commit_stats":null,"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"purl":"pkg:github/uplol/qwery","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/uplol%2Fqwery","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/uplol%2Fqwery/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/uplol%2Fqwery/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/uplol%2Fqwery/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/uplol","download_url":"https://codeload.github.com/uplol/qwery/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/uplol%2Fqwery/sbom","scorecard":{"id":911420,"data":{"date":"2025-08-11","repo":{"name":"github.com/uplol/qwery","commit":"a054c438cf9f5ab304ca6ba8931bdeb582458ab0"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":2.6,"checks":[{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"SAST","score":0,"reason":"no SAST tool detected","details":["Warn: no pull requests merged into dev branch"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Code-Review","score":0,"reason":"Found 0/23 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":0,"reason":"license file not detected","details":["Warn: project does not have a license file"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}}]},"last_synced_at":"2025-08-24T19:21:02.058Z","repository_id":50964272,"created_at":"2025-08-24T19:21:02.058Z","updated_at":"2025-08-24T19:21:02.058Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28518625,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-17T18:55:29.170Z","status":"ssl_error","status_checked_at":"2026-01-17T18:55:03.375Z","response_time":85,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["postgresql","query-builder","sql"],"created_at":"2026-01-17T21:27:32.135Z","updated_at":"2026-01-17T21:27:32.207Z","avatar_url":"https://github.com/uplol.png","language":"Python","readme":"# qwery\n\nqwery is a small and lightweight query builder based on asyncpg and pydantic.\n\n## why a query builder\n\nIn my opinion query builders strike a great balance between the flexibility of raw SQL, the structure and safety of pre-crafted queries, and the comfortable data layer of an ORM.\n\nThese benefits come with some downsides:\n\n- You lose some flexibility when crafting queries, especially when dealing with things like partial updates.\n- While the query builder interface does provide _some_ typing, its dynamic nature means it can never match the safety of pre-crafted queries with hand-written or generated types.\n- Complex queries returning non-standard data become unruly fast.\n\n## model, queries, helper pattern\n\nqwery works best with a model + queries + helper pattern, namely:\n\n- Models describe only data and how it is stored\n- Queries describe how models interact with the database\n- Helpers describe and implement the interaction _between_ models and the application (creation, fetching, etc)\n\n## example\n\n```py\nfrom pydantic import BaseModel\nfrom qwery import Query\n\n\nclass MyModel(BaseModel):\n    class Meta:\n        table_name = \"my_table\"\n\n    id: int\n    name: str\n    desc: Optional[str]\n    active: bool\n\n\nclass MyModelQueries:\n    create = Query(MyModel).insert(body=True).execute()\n    delete_by_id = Query(MyModel).delete().where(\"id = {.id}\").execute()\n    get_by_id = Query(MyModel).select().where(\"id = {.id}\").fetch_one()\n    get_all = Query(MyModel).select().fetch_all()\n\n\nasync with pool.acquire() as conn:\n    model = MyModel(id=1, name=\"test\", desc=None, active=True)\n    await MyModelQueries.create(conn, model=model)\n\n    model = await MyModelQueries.get_by_id(conn, id=1)\n    models = await MyModelQueries.get_all(conn)\n    assert models == [model]\n\n    await MyModelQueries.delete(conn, id=1)\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fuplol%2Fqwery","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fuplol%2Fqwery","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fuplol%2Fqwery/lists"}