{"id":38834832,"url":"https://github.com/skyduy/dblink","last_synced_at":"2026-01-17T13:55:13.461Z","repository":{"id":62567029,"uuid":"119522702","full_name":"skyduy/dblink","owner":"skyduy","description":"Easily query, insert, update, delete on an exist table in database.（基于sqlalchemy的通用ORM框架）","archived":false,"fork":false,"pushed_at":"2019-09-08T02:45:53.000Z","size":24,"stargazers_count":7,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-07-04T05:20:45.624Z","etag":null,"topics":["database","dblink","django-orm","sqlalchemy"],"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/skyduy.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":"2018-01-30T10:48:31.000Z","updated_at":"2021-03-30T18:28:10.000Z","dependencies_parsed_at":"2022-11-03T16:30:28.664Z","dependency_job_id":null,"html_url":"https://github.com/skyduy/dblink","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/skyduy/dblink","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/skyduy%2Fdblink","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/skyduy%2Fdblink/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/skyduy%2Fdblink/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/skyduy%2Fdblink/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/skyduy","download_url":"https://codeload.github.com/skyduy/dblink/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/skyduy%2Fdblink/sbom","scorecard":{"id":830556,"data":{"date":"2025-08-11","repo":{"name":"github.com/skyduy/dblink","commit":"0a364b6601794f262055374bdfafadeae9d9c9ea"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":2.6,"checks":[{"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":"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":"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":"Code-Review","score":0,"reason":"Found 0/27 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":"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":"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":"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":"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":"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-23T17:40:26.541Z","repository_id":62567029,"created_at":"2025-08-23T17:40:26.541Z","updated_at":"2025-08-23T17:40:26.541Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28509514,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-17T13:38:16.342Z","status":"ssl_error","status_checked_at":"2026-01-17T13:37:44.060Z","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":["database","dblink","django-orm","sqlalchemy"],"created_at":"2026-01-17T13:55:13.363Z","updated_at":"2026-01-17T13:55:13.448Z","avatar_url":"https://github.com/skyduy.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# dblink\n\n[![PyPI version](https://badge.fury.io/py/dblink.svg)](https://badge.fury.io/py/dblink)\n[![Build Status](https://travis-ci.org/skyduy/dblink.svg?branch=master)](https://travis-ci.org/skyduy/dblink)\n\n\u003e Aimed for easily using query, insert, update and delete with an exist table, the filter query syntax likes Django's. You can find out the simple usage in the code below.\n\n## Introduction\nSuppose you have two tables: `users` and `addresses` created by:\n\n```sql\nCREATE TABLE users (\n    id INTEGER NOT NULL,\n    name VARCHAR(50),\n    fullname VARCHAR(50),\n    password VARCHAR(12),\n    PRIMARY KEY (id)\n);\n\nCREATE TABLE addresses (\n    id INTEGER NOT NULL,\n    email_address VARCHAR NOT NULL,\n    user_id INTEGER,\n    PRIMARY KEY (id),\n    FOREIGN KEY(user_id) REFERENCES users (id)\n);\n```\n\nYou can link to exist table in database using [Database Urls](http://docs.sqlalchemy.org/en/latest/core/engines.html#database-urls).\n\n```python\nfrom dblink import Database, Table\ndb = Database(url='sqlite:///:memory:')\nuser_table = Table('users', db)\n# ...\ndb.close()\n\nwith Database(url='postgresql://scott:tiger@localhost/mydatabase') as db:\n    address_table = Table('addresses', db)\n    # ...\n```\n\nHere is a simple example.\n\n```python\n\"\"\"\nSuppose you have two table: users and addresses.\n\"\"\"\nfrom dblink import Database, Table\n\n\nwith Database('sqlite:///:memory:') as db:\n    table_user = Table('users', db)\n    table_address = Table('addresses', db)\n\n    # show description\n    print(table_user.description)\n    print(table_address.description)\n\n    # chain query, you can call delete on the single table result\n    table_user.query.filter(id=1).one_or_none()\n\n    table_user.query.filter(id__gte=2) \\\n                    .order_by('name') \\\n                    .values_list('id', 'name')\n\n    table_user.query.filter(id__in=[1, 2, 3]) \\\n                    .filter(name__startswith='Yu').all()\n\n    table_user.query.order_by('-name') \\\n                    .values_list('fullname', flat=True, distinct=True)\n\n    table_user.query.distinct('name').values_list('name', flat=True)\n\n    table_user.query.filter(id__in=[1, 2, 3]).delete()\n\n    # join query\n    table_user.join(table_address) \\\n              .filter(id__lt=10000) \\\n              .filter(email_address__contains='gmail') \\\n              .filter(**{'addresses.id__gte': 100}) \\\n              .values_list('user_id', 'name', 'email_address',\n                           table_address.id, 'users.fullname')\n\n    # get or insert\n    instance, create = table_user.get_or_insert(id=1, name='jone')\n\n    # single record operation.\n    table_user.insert({'id': 1, 'name': 'YuJun', 'password': 'psw'})\n\n    table_user.update({'id': 1, 'name': 'skyduy', 'password': 'psw'},\n                      unique_fields=['id'], update_fields=['name', 'password'])\n\n    table_user.insert_or_update(\n        {'id': 1, 'name': 'skyduy', 'password': 'psw'},\n        unique_fields=['id'], update_fields=['name', 'password']\n    )\n\n    table_user.delete({'id': 1, 'name': \"I don't matter\"},\n                      unique_fields=['id'])\n\n    # bulk operation\n    items = [{'id': 1, 'name': 'yujun', 'password': 'haha'},\n             {'id': 2, 'name': 'skyduy', 'password': 'aha'},]\n    unique_fields = ['id']\n    update_fields = ['name']\n    table_user.bulk_insert(items)\n    table_user.bulk_delete(items, unique_fields)\n    table_user.bulk_update(items, unique_fields, update_fields)\n    table_user.bulk_insert_or_update(items, unique_fields, update_fields)\n```\n\n## History\n### V0.3.0 (2019/09/08)\n- Update requirements for security.\n- Fix the installation bugs on windows.\n\n### V0.2.1 (2018/05/09)\n\n- Add encoding option.\n- Improve package dependence.\n\n### V0.2.0 (2018/03/24)\n\n- Bug fix.\n  - Error closing cursor when operation on local sqlite db.\n  - Bugs in bulk_insert_or_update.\n\n- Improve Error tips.\n\n### V0.1.2 (2018/02/05)\n\n- Initial release.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fskyduy%2Fdblink","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fskyduy%2Fdblink","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fskyduy%2Fdblink/lists"}