{"id":22757050,"url":"https://github.com/kolman-freecss/kf-postgresql-sample","last_synced_at":"2026-05-11T02:23:54.777Z","repository":{"id":266309863,"uuid":"897400223","full_name":"Kolman-Freecss/kf-postgresql-sample","owner":"Kolman-Freecss","description":null,"archived":false,"fork":false,"pushed_at":"2025-01-17T11:25:38.000Z","size":5645,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-02-05T10:13:36.268Z","etag":null,"topics":["docker","groovy","postgresql","sql"],"latest_commit_sha":null,"homepage":"","language":"Groovy","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/Kolman-Freecss.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-12-02T15:08:39.000Z","updated_at":"2025-01-17T11:25:39.000Z","dependencies_parsed_at":null,"dependency_job_id":"00fe789b-842b-4142-a378-cc633d602911","html_url":"https://github.com/Kolman-Freecss/kf-postgresql-sample","commit_stats":null,"previous_names":["kolman-freecss/kf-postgresql-sample"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Kolman-Freecss%2Fkf-postgresql-sample","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Kolman-Freecss%2Fkf-postgresql-sample/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Kolman-Freecss%2Fkf-postgresql-sample/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Kolman-Freecss%2Fkf-postgresql-sample/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Kolman-Freecss","download_url":"https://codeload.github.com/Kolman-Freecss/kf-postgresql-sample/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246290678,"owners_count":20753732,"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":["docker","groovy","postgresql","sql"],"created_at":"2024-12-11T07:16:59.620Z","updated_at":"2026-05-11T02:23:54.744Z","avatar_url":"https://github.com/Kolman-Freecss.png","language":"Groovy","funding_links":[],"categories":[],"sub_categories":[],"readme":"# kf-postgresql-db-sample\n\nThis project demonstrates how to use Groovy to execute basic SQL operations on a PostgreSQL database. The database is\ninitialized using a Docker container with an `init.sql` script, and the project is managed with Maven. It is a simple\ntest project to showcase database interactions such as **INSERT**, **SELECT**, **UPDATE**, and **DELETE**, as well as *\n*INNER JOIN** queries, all written in Groovy.\n\n___\n\n## Table of Contents\n\n- [Graph](#graph)\n- [Prerequisites](#prerequisites)\n- [Tech Stack](#tech-stack)\n- [Features](#features)\n- [Key Notes](#key-notes)\n- [How to Run](#how-to-run)\n- [Interaction](#interaction)\n    - [Groovy Script](#groovy-script)\n    - [Terminal way to interact with the database](#terminal-way-to-interact-with-the-database)\n\n---\n\n## Graph\n\nBasic Groovy PostgreSQL graph image flow:\n\n![Groovy PostgreSQL Graph](Basic-Groovy-PostgreSQL.png)\n\nExample of a more basic app flow:\n\n![Basic App Flow](ExampleBasicAppFlow.png)\n\n---\n\n## Prerequisites\n\n1. **Docker**: Ensure Docker is installed and running.\n2. **Maven**: Install Maven to manage dependencies and build the project.\n3. **JDK 8+**: A compatible Java Development Kit is required to run the Groovy scripts.\n\n___\n\n## Tech Stack\n\n- **Groovy**: A dynamic programming language for JVM.\n- **PostgreSQL**: A powerful, open-source relational database.\n- **Docker**: Used to containerize the PostgreSQL instance.\n- **Maven**: For project and dependency management.\n\n---\n\n## Features\n\n- **Database Initialization**: A PostgreSQL database is automatically created and seeded using a provided `init.sql`\n  script.\n- **Groovy Scripting**: Simple Groovy scripts are used to interact with the database using SQL.\n- **Dockerized Environment**: The PostgreSQL database runs in a Docker container for easy setup and portability.\n- **Maven Build**: Dependency management is handled with Maven, ensuring a smooth build and execution process.\n\n---\n\n## Key Notes\n\n- This project is for **testing purposes only** and is not optimized for production use.\n- The Groovy script connects to the PostgreSQL database using the JDBC driver and performs basic SQL operations.\n- To extend the project, modify `init.sql` or add more functionality in the Groovy script.\n\n---\n\n## How to Run\n\n1. **Start the PostgreSQL Container**\n    - Build and run the Docker container using the provided `Dockerfile`. The database will be initialized using\n      `init.sql`.\n\n   Build docker image\n   ```bash\n   docker build -t kf-postgre-sample-image .\n   ```\n   Run the container\n    ```bash\n   docker run -d -p 5432:5432 --name kf-postgre-sample kf-postgre-sample-image\n    ```\n   Start existing container\n    ```bash\n   docker start kf-postgre-sample\n    ```\n\n___\n\n## Interaction\n\n### **Groovy Script**\n\n- The Groovy script `Main.groovy` contains the main logic for interacting with the PostgreSQL database.\n- The script connects to the database using the JDBC driver and executes SQL queries.\n- The script demonstrates basic SQL operations such as **INSERT**, **SELECT**, **UPDATE**, and **DELETE**.\n- It also showcases an **INNER JOIN** query to fetch data from multiple tables.\n- To run the script, execute the following command:\n  ```bash\n  groovy Main.groovy\n  ```\n\n### **Terminal way to interact with the database**\n\nConnect to docker container:\n\n```bash\ndocker exec -it kf-postgre-sample bash\n```\n\nConnect to the database:\n\n```bash\npsql -U user -d testdb\n```\n\nList all databases:\n\n```bash\n\\l\n```\n\nExecute INNER JOIN query:\n\n```sql\nSELECT o.id AS order_id, u.name, u.email, o.product, o.amount\nFROM orders o\nINNER JOIN users u ON o.user_id = u.id\n;\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkolman-freecss%2Fkf-postgresql-sample","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkolman-freecss%2Fkf-postgresql-sample","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkolman-freecss%2Fkf-postgresql-sample/lists"}