{"id":24480574,"url":"https://github.com/szj2ys/sqlstar","last_synced_at":"2026-02-28T19:01:08.315Z","repository":{"id":57470626,"uuid":"404909408","full_name":"szj2ys/sqlstar","owner":"szj2ys","description":"✨ Awesome databases framework that shines ✨","archived":false,"fork":false,"pushed_at":"2024-12-19T02:33:22.000Z","size":2679,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-11-27T22:45:34.814Z","etag":null,"topics":["database","mysql","python","sqlite","sqlite3"],"latest_commit_sha":null,"homepage":"","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/szj2ys.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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}},"created_at":"2021-09-10T00:34:49.000Z","updated_at":"2024-12-19T02:33:25.000Z","dependencies_parsed_at":"2024-12-21T06:17:04.853Z","dependency_job_id":null,"html_url":"https://github.com/szj2ys/sqlstar","commit_stats":{"total_commits":54,"total_committers":1,"mean_commits":54.0,"dds":0.0,"last_synced_commit":"cee5b4a422274f9d1b65f92ffc14674929627c72"},"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/szj2ys/sqlstar","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/szj2ys%2Fsqlstar","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/szj2ys%2Fsqlstar/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/szj2ys%2Fsqlstar/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/szj2ys%2Fsqlstar/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/szj2ys","download_url":"https://codeload.github.com/szj2ys/sqlstar/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/szj2ys%2Fsqlstar/sbom","scorecard":{"id":864308,"data":{"date":"2025-08-11","repo":{"name":"github.com/szj2ys/sqlstar","commit":"ac9c0a4b4d993c7cc4e02a503c7d84408d13bf13"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":2.7,"checks":[{"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":"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":"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":"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":"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":"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":"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":"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":"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":"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":"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":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"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"}},{"name":"Vulnerabilities","score":7,"reason":"3 existing vulnerabilities detected","details":["Warn: Project is vulnerable to: PYSEC-2022-14 / GHSA-39ph-wr67-j4xq","Warn: Project is vulnerable to: PYSEC-2020-73","Warn: Project is vulnerable to: GHSA-v9hf-5j83-6xpp"],"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}}]},"last_synced_at":"2025-08-24T02:15:02.174Z","repository_id":57470626,"created_at":"2025-08-24T02:15:02.174Z","updated_at":"2025-08-24T02:15:02.174Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29948228,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-28T18:42:55.706Z","status":"ssl_error","status_checked_at":"2026-02-28T18:42:48.811Z","response_time":90,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: 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","mysql","python","sqlite","sqlite3"],"created_at":"2025-01-21T11:16:28.150Z","updated_at":"2026-02-28T19:01:08.298Z","avatar_url":"https://github.com/szj2ys.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\n    \u003cimg width=\"350\" height=\"150\" src=\"https://cdn.jsdelivr.net/gh/szj2ys/sqlstar/sqlstar/logo.png\"/\u003e\n\u003c/p\u003e\n\n\u003ch3 align=\"center\"\u003e\n    \u003cp\u003e✨ Awesome databases framework that shines ✨\u003c/p\u003e\n\u003c/h3\u003e\n\n\u003cp align=\"center\"\u003e\n    \u003ca href=\"https://python.org/pypi/sqlstar\"\u003e\n        \u003cimg src=\"https://badge.fury.io/py/sqlstar.svg\" alt=\"Version\"/\u003e\n    \u003c/a\u003e\n    \u003ca href=\"https://python.org/pypi/sqlstar\"\u003e\n        \u003cimg src=\"https://img.shields.io/pypi/l/sqlstar.svg?color=blue\" \nalt=\"License\"/\u003e\n    \u003c/a\u003e\n    \u003ca href=\"https://python.org/pypi/sqlstar\"\u003e\n        \u003cimg src=\"https://static.pepy.tech/badge/sqlstar?color=blue\" alt=\"pypi total downloads\"/\u003e\n    \u003c/a\u003e\n    \u003ca href=\"https://python.org/pypi/sqlstar\"\u003e\n        \u003cimg src=\"https://img.shields.io/github/last-commit/szj2ys/sqlstar?color=blue\" alt=\"GitHub last commit\"/\u003e\n    \u003c/a\u003e\n\u003c/p\u003e\n\n\nBreaking changes ⚙ 🔑 🎉 🎠 ❌\n- **easy to use:** lots of out-of-the-box methods.\n- **less bug:** not like others, I don't want to name it, and if you \n  unluckily enough to encounter, it's easy to solve by yourself.\n\n\n## Installation ⚙🙈\n```shell\npip install sqlstar\n```\nif you need help\n```shell\nsqlstar -h\n```\n\n## Tips and tricks ✅\n\n\u003cdetails\u003e\n  \u003csummary\u003eGuides 📝\u003c/summary\u003e\n\n\u003efor now, there is only mysql backend...\n\n## connection\n```python\nimport sqlstar\n\n# driver://user:passwd@host:port/dbname\nmysql = sqlstar.Database('mysql://root:***@localhost/tmp')\nmysql.connect()\n```\n## Query\n```python\nQUERY = '''\n    SELECT *\n    FROM Girls\n    WHERE AGE BETWEEN 20 AND 24\n        AND BOYFRIEND IS NULL\n    ORDER BY WHITE, RICH, BEAUTY DESC;\n'''\n```\n### Fetch data, and format result into Dataframe\n```python\ndf = mysql.fetch_df(QUERY)\n```\nFetch all the rows\n```python\ndata = mysql.fetch_all(QUERY)\n```\nFetch several rows\n```python\ndata = mysql.fetch_many(QUERY, 3)\n```\n\n## Execute\n```python\nmysql.execute(\"\"\"\n    CREATE TABLE `users` (\n        `id` int(11) NOT NULL AUTO_INCREMENT,\n        `email` varchar(255) COLLATE utf8_bin NOT NULL,\n        `password` varchar(255) COLLATE utf8_bin NOT NULL,\n        PRIMARY KEY (`id`)\n    ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin\n    AUTO_INCREMENT=1 ;\n    \"\"\")\n```\n\n## Insert\n### Insert many records\n```python\nmysql.insert_many(table, data, cols)\n```\n### Insert Dataframe type of data\n```python\nmysql.insert_df(table, df)\n```\n\n## Export\n### Export result to csv\n```python\nmysql.export_csv(query, fname, sep)\n```\n### Export result to excel\n```python\nmysql.export_excel(query, fname)\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n  \u003csummary\u003eNice Features ✨\u003c/summary\u003e\n\n### Create table\n```python\nmysql.create_table(\n    \"users\",\n    comments={\n        \"name\": \"姓名\",\n        \"height\": \"身高\",\n        \"weight\": \"体重\"\n    },\n    dtypes={\n        \"varchar(30)\": [\n            \"name\",\n            \"occupation\",\n        ],\n        \"float\": [\"height\", \"weight\"],\n        \"int\": [\"age\"],\n    },\n)\n```\nif you have data, you can make it more simple, just like this\n```python\nmysql.create_table(\"users\", df)\n```\nif you only want to specify some of them\n```python\nmysql.create_table(\n    table='news_spider',\n    df=df,\n    comments={\n        \"create_time\": \"插入时间\",\n        \"title\": \"标题\",\n        \"content\": \"正文\",\n        \"author\": \"作者\",\n        \"publish_time\": \"发布时间\",\n        \"read_num\": \"阅读量\",\n    },\n    # if type is not given, sqlstar will automatically inference\n    dtypes={\n        \"datetime\": [\"create_time\", \"publish_time\"],\n        \"longtext\": [\"content\"],\n        \"varchar(100)\": [\"title\", \"author\"],\n        \"decimal(10, 3)\": [\"read_num\"]\n    })\n```\nYou don't need to fill in everything, and you just need to fill in \ncomment or data type that you want to specify, then \n`sqlstar` will do the rest for you.\n\n### Rename table\n```python\nmysql.rename_table(table, name)\n```\n\n### Rename column\n```python\nmysql.rename_column(table, column, name, dtype)\n```\n\n### Add new column\n```python\nmysql.add_column(table, column, dtype, comment, after)\n```\n### Add comment for table\n```python\nmysql.add_table_comment(table, comment)\n```\n\n### Change column's attribute\n```python\nmysql.change_column_attribute(table, column, dtype, notnull, comment)\n```\n\n### Set primary key\n```python\nmysql.add_primary_key(table, primary_key)\n```\n\n### Truncate table's data, but keep the table structure\n```python\nmysql.truncate_table(table)\n```\n\n### Drop table\n```python\nmysql.drop_table(table)\n```\n\n### Drop column\n```python\nmysql.drop_column(table, column)\n```\n\n\u003c/details\u003e\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fszj2ys%2Fsqlstar","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fszj2ys%2Fsqlstar","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fszj2ys%2Fsqlstar/lists"}