{"id":15104871,"url":"https://github.com/asaniczka/psycopg-vs-sqlalchemy","last_synced_at":"2025-04-05T12:40:31.132Z","repository":{"id":255261052,"uuid":"848965788","full_name":"asaniczka/psycopg-vs-sqlalchemy","owner":"asaniczka","description":"Performance comparision between Psycopg vs SQLAlchemy","archived":false,"fork":false,"pushed_at":"2024-08-28T20:40:39.000Z","size":10,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-10T23:52:46.496Z","etag":null,"topics":["postgres","psycopg","sqlalchemy"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/asaniczka.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-08-28T18:20:56.000Z","updated_at":"2024-08-28T20:41:52.000Z","dependencies_parsed_at":"2024-08-28T23:06:50.946Z","dependency_job_id":null,"html_url":"https://github.com/asaniczka/psycopg-vs-sqlalchemy","commit_stats":null,"previous_names":["asaniczka/psycopg-vs-sqlalchemy"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/asaniczka%2Fpsycopg-vs-sqlalchemy","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/asaniczka%2Fpsycopg-vs-sqlalchemy/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/asaniczka%2Fpsycopg-vs-sqlalchemy/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/asaniczka%2Fpsycopg-vs-sqlalchemy/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/asaniczka","download_url":"https://codeload.github.com/asaniczka/psycopg-vs-sqlalchemy/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247339132,"owners_count":20923009,"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":["postgres","psycopg","sqlalchemy"],"created_at":"2024-09-25T20:03:19.091Z","updated_at":"2025-04-05T12:40:31.111Z","avatar_url":"https://github.com/asaniczka.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Database Benchmarking with Psycopg and SQLAlchemy\n\nThis repository contains a Python script to benchmark the direct PostgreSQL driver (Psycopg) against the SQLAlchemy ORM for various operations in a PostgreSQL database. It is set up to run within a Docker environment using Docker Compose, which makes it easy to set up and manage dependencies.\n\n## Benchmarking Results\n\nAfter running the benchmarks, the following results were obtained:\n\n```lua\n+------------------------------+--------------------+----------+\n| Method                       | Duration           | Slowness |\n+------------------------------+--------------------+----------+\n| Psycopg Concurrent Select    | 23.1590388789773   | 0        |\n| SQLAlchemy Concurrent Select | 44.13823398994282  | 1.91x    |\n| Psycopg Concurrent update    | 36.27983471401967  | 0        |\n| SQLAlchemy Concurrent update | 68.65683276113123  | 1.89x    |\n| Psycopg Batch Add            | 2.0081764010246843 | 0        |\n| SQLAlchemy Batch Add         | 5.3562933770008385 | 2.67x    |\n| Psycopg Concurrent Add       | 22.738574070157483 | 0        |\n| SQLAlchemy Concurrent Add    | 37.764774970011786 | 1.66x    |\n+------------------------------+--------------------+----------+\n```\n\n## Table of Contents\n\n- [Prerequisites](#prerequisites)\n- [Installation](#installation)\n- [Usage](#usage)\n- [License](#license)\n\n## Prerequisites\n\nMake sure you have Docker and Docker Compose installed on your machine. You can download them from [Docker's official website](https://www.docker.com/get-started).\n\n## Installation\n\nClone this repository to your local machine:\n\n```bash\ngit clone https://github.com/asaniczka/psycopg-vs-sqlalchemy\ncd psycopg-vs-sqlalchemy\n```\n\n## Usage\n\n### 1. Build and Start the Docker Containers:\n\nRun the following command to start the PostgreSQL and pgAdmin services defined in the `docker-compose.yml` file:\n\n```bash\ndocker-compose up\n```\n\nThis will start a PostgreSQL server on port `5431` and pgAdmin on port `5050`.\n\n### 2. Access pgAdmin:\n\n- Open your browser and navigate to `http://localhost:5050`.\n- Log in with the credentials defined in the `docker-compose.yml`:\n  - Email: `name@domain.com`\n  - Password: `password`\n\n### 3. Run the Benchmarking Script:\n\nMake sure you have all necessary Python dependencies installed. You can use a virtual environment and install with:\n\n```bash\npip install -r requirements.txt\n```\n\nAfter the services are running, you can execute the benchmarking script:\n\n```bash\npython3 benchmark.py\n```\n\n## License\n\nThis project is licensed under the MIT License. See the [LICENSE](LICENSE) file for more details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fasaniczka%2Fpsycopg-vs-sqlalchemy","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fasaniczka%2Fpsycopg-vs-sqlalchemy","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fasaniczka%2Fpsycopg-vs-sqlalchemy/lists"}