{"id":20986353,"url":"https://github.com/mgobeaalcoba/python_postgresql","last_synced_at":"2026-04-09T21:46:15.845Z","repository":{"id":243591097,"uuid":"812841271","full_name":"Mgobeaalcoba/python_postgresql","owner":"Mgobeaalcoba","description":"Examples of connecting to Postgres to exploit data and creating tables in Postgres directly from Python","archived":false,"fork":false,"pushed_at":"2024-06-27T20:45:54.000Z","size":27,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-01-20T07:32:08.553Z","etag":null,"topics":["data-engineering","database-management","dotenv","postgresql","psycopg2","python3"],"latest_commit_sha":null,"homepage":"","language":"Jupyter Notebook","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/Mgobeaalcoba.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-06-10T01:51:14.000Z","updated_at":"2024-06-27T20:45:58.000Z","dependencies_parsed_at":"2024-06-27T23:30:27.556Z","dependency_job_id":null,"html_url":"https://github.com/Mgobeaalcoba/python_postgresql","commit_stats":null,"previous_names":["mgobeaalcoba/python_postgresql"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Mgobeaalcoba%2Fpython_postgresql","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Mgobeaalcoba%2Fpython_postgresql/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Mgobeaalcoba%2Fpython_postgresql/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Mgobeaalcoba%2Fpython_postgresql/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Mgobeaalcoba","download_url":"https://codeload.github.com/Mgobeaalcoba/python_postgresql/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243392819,"owners_count":20283657,"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":["data-engineering","database-management","dotenv","postgresql","psycopg2","python3"],"created_at":"2024-11-19T06:13:12.466Z","updated_at":"2025-12-28T21:33:26.103Z","avatar_url":"https://github.com/Mgobeaalcoba.png","language":"Jupyter Notebook","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Connecting and Manipulating PostgreSQL with Python\n\n![Visitors](https://api.visitorbadge.io/api/visitors?path=https%3A%2F%2Fgithub.com%2FMgobeaalcoba%2Fpython_postgresql\u0026label=Visitors\u0026countColor=%23263759)\n\nThis repository contains a Jupyter Notebook with examples of how to connect Python with PostgreSQL and how to create and manipulate tables in PostgreSQL using Python.\n\n## Content\n\n- **Connection to PostgreSQL**: Examples of how to establish a connection with a PostgreSQL database using `psycopg2` and `SQLAlchemy`.\n- **Loading Data into a DataFrame**: How to load data from PostgreSQL into a Pandas DataFrame.\n- **Data Manipulation**: Examples of data manipulation using Pandas.\n- **Creating Tables in PostgreSQL**: How to create new tables in PostgreSQL from manipulated DataFrames.\n- **Credential Management**: Using a `.env` file to manage credentials securely.\n\n## Requirements\n\n-Python 3.x\n- Jupyter Notebook\n- Pandas\n- psycopg2\n-SQLAlchemy\n- python-dotenv\n\n## Facility\n\n1. Clone this repository:\n\n ```bash\n git clone https://github.com/Mgobeaalcoba/python_postgresql\n ```\n\n2. Create a virtual environment and install dependencies:\n\n ```bash\n python -m venv venv\n source venv/bin/activate # On Windows use `venv\\Scripts\\activate`\n pip install -r requirements.txt\n ```\n\n3. Create a `.env` file in the project root directory with the following content, replacing the values ​​with your PostgreSQL credentials:\n\n ```bash\n POSTGRES_DB=database_name\n POSTGRES_USER=user_name\n POSTGRES_PASSWORD=your_password\n POSTGRES_HOST=localhost\n POSTGRES_PORT=5432\n ```\n\n4. Start Jupyter Notebook:\n\n ```bash\n jupyter notebook\n ```\n\n5. Open the `conexión de jupyter a postgres sql.ipynb` notebook and follow the examples.\n\n## Use\n\nThe notebook includes detailed examples on how to:\n\n- Connect to a PostgreSQL database.\n- Execute SQL queries and load the results into a Pandas DataFrame.\n- Manipulate the data in the DataFrame.\n- Create a new table in PostgreSQL and save the manipulated data in it.\n\n## Grades\n\n- Make sure the `.env` file is in your `.gitignore` to avoid uploading your credentials to the repository.\n- Review and adjust configurations and credentials based on your development and production environment.\n\n## Contributions\n\nContributions are welcome! Feel free to open an issue or submit a pull request.\n\n## License\n\nThis project is licensed under the MIT License. See the `LICENSE` file for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmgobeaalcoba%2Fpython_postgresql","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmgobeaalcoba%2Fpython_postgresql","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmgobeaalcoba%2Fpython_postgresql/lists"}