{"id":15050609,"url":"https://github.com/plandes/dbutil","last_synced_at":"2026-04-10T10:32:19.679Z","repository":{"id":57478143,"uuid":"198828859","full_name":"plandes/dbutil","owner":"plandes","description":"Database convenience utilities.","archived":false,"fork":false,"pushed_at":"2026-01-01T01:44:16.000Z","size":337,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2026-01-03T07:14:16.957Z","etag":null,"topics":["database","database-management","orm","sqlite","sqlite-orm"],"latest_commit_sha":null,"homepage":"https://plandes.github.io/dbutil/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/plandes.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2019-07-25T12:39:31.000Z","updated_at":"2026-01-01T01:43:23.000Z","dependencies_parsed_at":"2024-06-21T21:06:20.966Z","dependency_job_id":null,"html_url":"https://github.com/plandes/dbutil","commit_stats":null,"previous_names":[],"tags_count":21,"template":false,"template_full_name":null,"purl":"pkg:github/plandes/dbutil","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/plandes%2Fdbutil","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/plandes%2Fdbutil/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/plandes%2Fdbutil/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/plandes%2Fdbutil/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/plandes","download_url":"https://codeload.github.com/plandes/dbutil/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/plandes%2Fdbutil/sbom","scorecard":{"id":736823,"data":{"date":"2025-08-11","repo":{"name":"github.com/plandes/dbutil","commit":"a828d73da847a737660ae3d485e9cd3c3d076ad8"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3.5,"checks":[{"name":"Dangerous-Workflow","score":10,"reason":"no dangerous workflow patterns detected","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":"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":"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":"Code-Review","score":0,"reason":"Found 0/30 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":"Maintained","score":1,"reason":"2 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 1","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Token-Permissions","score":0,"reason":"detected GitHub workflow tokens with excessive permissions","details":["Warn: no topLevel permission defined: .github/workflows/test.yml:1","Info: no jobLevel write permissions found"],"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":0,"reason":"dependency not pinned by hash detected -- score normalized to 0","details":["Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/test.yml:17: update your workflow using https://app.stepsecurity.io/secureworkflow/plandes/dbutil/test.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/test.yml:22: update your workflow using https://app.stepsecurity.io/secureworkflow/plandes/dbutil/test.yml/master?enable=pin","Warn: pipCommand not pinned by hash: .github/workflows/test.yml:28","Warn: downloadThenRun not pinned by hash: .github/workflows/test.yml:34","Info:   0 out of   2 GitHub-owned GitHubAction dependencies pinned","Info:   0 out of   1 pipCommand dependencies pinned","Info:   0 out of   1 downloadThenRun dependencies pinned"],"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":"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":9,"reason":"license file detected","details":["Info: project has a license file: LICENSE.md:0","Warn: project license file does not contain an FSF or OSI license."],"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-22T16:08:04.975Z","repository_id":57478143,"created_at":"2025-08-22T16:08:04.975Z","updated_at":"2025-08-22T16:08:04.975Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31638445,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-10T07:40:12.752Z","status":"ssl_error","status_checked_at":"2026-04-10T07:40:11.664Z","response_time":98,"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":["database","database-management","orm","sqlite","sqlite-orm"],"created_at":"2024-09-24T21:27:56.559Z","updated_at":"2026-04-10T10:32:19.670Z","avatar_url":"https://github.com/plandes.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Database convenience utilities.\n\n[![PyPI][pypi-badge]][pypi-link]\n[![Python 3.13][python313-badge]][python313-link]\n[![Python 3.12][python312-badge]][python312-link]\n[![Build Status][build-badge]][build-link]\n\nA library of database convenience utilities, typically for creation of\ntemporary files for processing large data.\n\nFeatures:\n* DB-API Interface allows combined SQL rapid prototyping with backing\nprogrammatic usage.\n* Java Beans like persistence.\n* Integration with [zensols.util stash].\n* [SQLite] integration.\n* [PostgreSQL] integration with the [dbutilpg] library.\n* [Pandas] data frame creation, which is agnostic of database provider.\n\n\n## Documentation\n\nSee the [full documentation](https://plandes.github.io/dbutil/index.html).\nThe [API reference](https://plandes.github.io/dbutil/api.html) is also\navailable.\n\n\n## Obtaining\n\nThe easist way to install the command line program is via the `pip` installer:\n```bash\npip3 install zensols.db\n```\n\nBinaries are also available on [pypi].\n\n\n## Usage\n\nA simple example is detailed below, and also found in the [repo](example).\n\n\n### SQL binding file\n\nFirst, create the SQL file, which is used to create and access the database.\nHere we can replace `name, age` with `${cols}` and call it `person.sql`:\n\n```sql\n-- meta=init_sections=create_tables,create_idx\n\n-- name=create_idx\ncreate index person_name on person(name);\n\n-- name=create_tables\ncreate table person (name text, age int);\n\n-- name=insert_person\ninsert into person (${cols}) values (?, ?);\n\n-- name=select_people; note that the order is needed for the unit tests only\nselect ${cols}, rowid as id\n       from person\n       order by name;\n\n-- name=select_people_by_id\nselect ${cols}, rowid as id from person where id = ?;\n\n-- name=update_person\nupdate person set name = ?, age = ? where rowid = ?;\n\n-- name=delete_person\ndelete from person where rowid = ?;\n```\n\n### Persister\n\nNext, create the application context with a persister that is the SQL to client\nbinding and call it `app.conf`:\n\n```ini\n# command line interaction\n[cli]\nclass_name = zensols.cli.ActionCliManager\napps = list: app\n\n# the connection manager, which is the DB binding and in our case SQLite\n[sqlite_conn_manager]\nclass_name = zensols.db.sqlite.SqliteConnectionManager\ndb_file = path: person.db\n\n# the persister binds the API to the SQL\n[person_persister]\nclass_name = zensols.db.dataclass.DataClassDbPersister\nbean_class = class: app.Person\nsql_file = person.sql\nconn_manager = instance: sqlite_conn_manager\ninsert_name = insert_person\nselect_name = select_people\nselect_by_id = select_people_by_id\nupdate_name = update_person\ndelete_name = delete_person\n\n# the application class invoked by the CLI\n[app]\nclass_name = app.Application\npersister = instance: person_persister\n```\n\n\n### Application\n\nDefine the *bean*, which provides the metadata for the `${cols}` in\n`person.sql` and can (but not must) be used with the API to CRUD rows:\n\n```python\nfrom dataclasses import dataclass, field\nfrom zensols.db import BeanDbPersister\n\n\n@dataclass\nclass Person(object):\n    name: str = field()\n    age: int = field()\n    id: int = field(default=None)\n\n\n@dataclass\nclass Application(object):\n    \"\"\"A people database\"\"\"\n\n    persister: BeanDbPersister\n\n    def demo(self):\n        # create a row using an instance of a dataclass and return the unique\n        # ID of the inserted row\n        paul_id: int = self.persister.insert(Person('Paul', 31))\n\n        # we can also insert by columns in the order given in the dataclass\n        jane_id: int = self.persister.insert_row('Jane', 32)\n\n        # print everyone in the database\n        print(self.persister.get())\n\n        # delete a row\n        self.persister.delete(paul_id)\n        print(self.persister.get())\n\n        # update jane's age\n        self.persister.update_row(jane_id, 'jane', 36)\n\n        # get the updated row we just set\n        jane = self.persister.get_by_id(jane_id)\n        print(f'jane: {jane}')\n\n        # clean up, which for SQLite deletes the file\n        self.persister.conn_manager.drop()\n```\n\nCreate the entry point used on the command line and call it `run.py`:\n\n```python\nfrom zensols.cli import CliHarness\n\nCliHarness(app_config_resource='app.conf').run()\n```\n\n\n### Run\n\n```bash\n$ ./run.py -h\nUsage: run.py [options]:\n\nA people database.\n\nOptions:\n  -h, --help      show this help message and exit\n  --version       show the program version and exit\n\n$ ./run.py\n(Person(name='Jane', age=32, id=2), Person(name='Paul', age=31, id=1))\n(Person(name='Jane', age=32, id=2),)\njane: Person(name='jane', age=36, id=2)\n```\n\nSee the [use cases](tests/test_sqlite.py) for more detailed examples of\nhow to use the API.\n\n\n## Changelog\n\nAn extensive changelog is available [here](CHANGELOG.md).\n\n\n## Community\n\nPlease star this repository and let me know how and where you use this API.\n[Contributions](CONTRIBUTING.md) as pull requests, feedback, and any input is\nwelcome.\n\n\n## License\n\n[MIT License](LICENSE.md)\n\nCopyright (c) 2020 - 2026 Paul Landes\n\n\n\u003c!-- links --\u003e\n[pypi]: https://pypi.org/project/zensols.db/\n[pypi-link]: https://pypi.python.org/pypi/zensols.db\n[pypi-badge]: https://img.shields.io/pypi/v/zensols.db.svg\n[python313-badge]: https://img.shields.io/badge/python-3.13-blue.svg\n[python313-link]: https://www.python.org/downloads/release/python-3130\n[python312-badge]: https://img.shields.io/badge/python-3.12-blue.svg\n[python312-link]: https://www.python.org/downloads/release/python-3120\n[build-badge]: https://github.com/plandes/dbutil/workflows/CI/badge.svg\n[build-link]: https://github.com/plandes/dbutil/actions\n\n[zensols.util stash]: https://github.com/plandes/util/blob/master/src/python/zensols/util/persist.py\n[SQLite]: https://www.sqlite.org/index.html\n\n[PostgreSQL]: https://www.postgresql.org\n[dbutilpg]: https://github.com/plandes/dbutilpg\n[Pandas]: https://pandas.pydata.org\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fplandes%2Fdbutil","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fplandes%2Fdbutil","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fplandes%2Fdbutil/lists"}