{"id":25543596,"url":"https://github.com/joumaico/unisql","last_synced_at":"2025-09-13T06:33:18.952Z","repository":{"id":243257084,"uuid":"810851445","full_name":"joumaico/unisql","owner":"joumaico","description":"SQL Database Wrapper","archived":false,"fork":false,"pushed_at":"2024-06-12T11:38:29.000Z","size":18,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-11T09:27:03.477Z","etag":null,"topics":["python","sql"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/joumaico.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}},"created_at":"2024-06-05T13:21:34.000Z","updated_at":"2024-06-12T11:34:44.000Z","dependencies_parsed_at":"2024-06-07T17:03:07.624Z","dependency_job_id":"a7505b9c-11dc-48ac-a3ac-7a77b96c79d3","html_url":"https://github.com/joumaico/unisql","commit_stats":null,"previous_names":["joumaico/unisql"],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/joumaico%2Funisql","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/joumaico%2Funisql/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/joumaico%2Funisql/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/joumaico%2Funisql/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/joumaico","download_url":"https://codeload.github.com/joumaico/unisql/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239799617,"owners_count":19699086,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["python","sql"],"created_at":"2025-02-20T07:38:00.892Z","updated_at":"2025-09-13T06:33:18.945Z","avatar_url":"https://github.com/joumaico.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# UniSQL: SQL Database Wrapper\n\nUniSQL is a software package that offers a unified interface for connecting to and interacting with various database engines, including SQLite, MySQL, and PostgreSQL. This package simplifies database management by abstracting the underlying complexities of each database engine, providing a consistent and user-friendly API for developers.\n\n## Installation\n\n```\nDependencies:\n\n- Python 3.8, 3.9, 3.11, 3.12, 3.13\n\nInstallation:\n\n$ pip install unisql\n```\n\n## Synchronous Connections\n\nFor synchronous connections, use the following code:\n\n```python\nfrom unisql import connect\n\n# SQLite\ndb = connect.sqlite(\"database.db\")\n\n# MySQL\ndb = connect.mysql(database=\"mydatabase\", host=\"localhost\", user=\"myuser\", password=\"mypassword\", port=3306)\n\n# PostgreSQL\ndb = connect.postgresql(database=\"mydatabase\", host=\"localhost\", user=\"myuser\", password=\"mypassword\", port=5432)\n```\n\n## Asynchronous Connections (with asyncio)\n\nFor asynchronous connections using asyncio, use the following code:\n\n```python\nfrom unisql.asyncio import connect\n\n# SQLite\ndb = await connect.sqlite(\"database.db\")\n\n# PostgreSQL\ndb = await connect.postgresql(database=\"mydatabase\", host=\"localhost\", user=\"myuser\", password=\"mypassword\", port=5432)\n```\n\n\u003e [!IMPORTANT]\n\u003e Asynchronous connections are currently not supported for MySQL in this package.\n\n## Executing Queries\n\nAfter establishing a connection, you can execute queries using the query and value properties, and then call the fetch or execute methods.\n\n```python\n# Set the query and values\nquery = \"SELECT * FROM users WHERE name = ? AND email = ?;\"\nvalue = (\"John Doe\", \"john@example.com\")\n\n# Fetch a single row\nresult = db.fetch(query, value, multiple=False)\n\n# Fetch all rows\nresults = db.fetch(query, value, multiple=True)\n\n# Execute an INSERT or UPDATE query at once\nquery = \"INSERT INTO users (name, email) VALUES (?, ?);\"\nvalue = (\"John Doe\", \"john@example.com\")\ndb.execute(query, value)\n\n# Execute an INSERT or UPDATE query at many\nvalue = [(\"Sam Smith\", \"sam@example.com\"), (\"Adam Page\", \"adam@example.com\")]\ndb.execute(query, value)\n```\n\nTo close the connection:\n\n```python\ndb.close()\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjoumaico%2Funisql","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjoumaico%2Funisql","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjoumaico%2Funisql/lists"}