psqleasy


Namepsqleasy JSON
Version 1.0.5 PyPI version JSON
download
home_pagehttps://github.com/SheikhTanvirSiddiki/psqleasy
SummaryUltra-simple PostgreSQL interface for Python
upload_time2025-07-22 11:14:05
maintainerNone
docs_urlNone
authorSheikh Tanvir Siddiki
requires_python>=3.7
licenseMIT
keywords postgresql postgres database sql orm psycopg2
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            ## PsqlEasy - PostgreSQL Made Simple

[![PyPI version](https://img.shields.io/pypi/v/psqleasy.svg)](https://pypi.org/project/psqleasy/)
[![Python Version](https://img.shields.io/pypi/pyversions/psqleasy)](https://pypi.org/project/psqleasy/)
[![License](https://img.shields.io/pypi/l/psqleasy)](https://opensource.org/licenses/MIT)

PsqlEasy is a Python library designed to make working with PostgreSQL databases as simple as possible.
It provides an intuitive interface for common database operations without requiring complex SQL knowledge.

## Features

- โœ… **Easy Connection Management** - Context managers for automatic connection handling
- ๐Ÿ”’ **SQL Injection Protection** - Built-in parameterized queries
- ๐Ÿ› ๏ธ **Full CRUD Operations** - Simple functions for Create, Read, Update, Delete
- ๐Ÿ” **Schema Inspection** - View tables and columns easily
- ๐Ÿš€ **Unified Query Interface** - One function for all common operations
- โšก **Lightweight** - Single dependency (psycopg2-binary)
- ๐Ÿ†• **Create Database Support** - Create a new PostgreSQL database directly
- ๐Ÿงช **Raw SQL Execution** - Pass raw SQL directly via query()

## Installation

```bash
pip install psqleasy
```

## Quick Start

```python
import psqleasy as psql

# Connect to database
with psql.connect("localhost", "user", "password", 5432, "mydb") as conn:
    # Create table
    psql.create_table(conn, "users", {
        "id": "SERIAL PRIMARY KEY",
        "name": "VARCHAR(100)",
        "email": "VARCHAR(255) UNIQUE"
    })

    # Insert data
    psql.insert_data(conn, "users", {
        "name": "John Doe",
        "email": "john@example.com"
    })

    # View data
    users = psql.view_data(conn, "users")
    print(users)
```

## Core Functions

### Connection Management
```python
with psql.connect(host, user, passwd, port, db) as conn:
    # Your database operations
```

### CRUD Operations
```python
# Create table
psql.create_table(conn, "products", {
    "id": "SERIAL PRIMARY KEY",
    "name": "VARCHAR(100)",
    "price": "DECIMAL(10,2)"
})

# Insert data
psql.insert_data(conn, "products", {
    "name": "Laptop",
    "price": 999.99
})

# View data
products = psql.view_data(conn, "products")

# Update data
psql.update_data(conn, "products",
    {"price": 899.99},
    "name = %s", ("Laptop",)
)

# Delete data
psql.delete_data(conn, "products",
    "name = %s", ("Laptop",)
)
```

### Schema Management
```python
# List all tables
tables = psql.show_tables(conn)

# Show table columns
columns = psql.show_columns(conn, "products")

# Drop table
psql.drop_table(conn, "temp_table")
```

### Advanced Features
```python
# Raw SQL query via unified interface
result = psql.query(
    conn,
    "SELECT * FROM products WHERE price > %s",
    params=(100,)
)

# Unified query interface for built-in operations
psql.query(conn, 'create', table_name="orders", columns={
    "id": "SERIAL PRIMARY KEY",
    "product_id": "INTEGER"
})

orders = psql.query(conn, 'select', table_name="orders")
```

### Supported operations in query()
- `'create_db'`: Create a new database
- `'create'`: Create a table
- `'insert'`: Insert data
- `'select'`: Select data
- `'update'`: Update rows
- `'delete'`: Delete rows
- `'drop'`: Drop table
- `'tables'`: Show table list
- `'columns'`: Show column info
- โœ… **Supports raw SQL**: `SELECT`, `INSERT`, `UPDATE`, `DELETE`, etc.

## Documentation

For complete documentation with detailed examples, please see:

๐Ÿ“š https://sheikhtanvirsiddiki.github.io/psqleasy/

## Contributing

Contributions are welcome! Please open an issue or submit a pull request.

1. Fork the repository
2. Create your feature branch (`git checkout -b feature/your-feature`)
3. Commit your changes (`git commit -am 'Add some feature'`)
4. Push to the branch (`git push origin feature/your-feature`)
5. Open a pull request

## License

This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.

---

<p align="center">
  <i>PostgreSQL made simple for Python developers</i>
</p>

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/SheikhTanvirSiddiki/psqleasy",
    "name": "psqleasy",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.7",
    "maintainer_email": null,
    "keywords": "postgresql, postgres, database, sql, orm, psycopg2",
    "author": "Sheikh Tanvir Siddiki",
    "author_email": "sheikhtanvirsiddiki55@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/a7/1b/23e4c74a2fa5380708d7d266d0427e1882f5d8fbbbc542d63b0ec0aa2b78/psqleasy-1.0.5.tar.gz",
    "platform": null,
    "description": "## PsqlEasy - PostgreSQL Made Simple\n\n[![PyPI version](https://img.shields.io/pypi/v/psqleasy.svg)](https://pypi.org/project/psqleasy/)\n[![Python Version](https://img.shields.io/pypi/pyversions/psqleasy)](https://pypi.org/project/psqleasy/)\n[![License](https://img.shields.io/pypi/l/psqleasy)](https://opensource.org/licenses/MIT)\n\nPsqlEasy is a Python library designed to make working with PostgreSQL databases as simple as possible.\nIt provides an intuitive interface for common database operations without requiring complex SQL knowledge.\n\n## Features\n\n- \u2705 **Easy Connection Management** - Context managers for automatic connection handling\n- \ud83d\udd12 **SQL Injection Protection** - Built-in parameterized queries\n- \ud83d\udee0\ufe0f **Full CRUD Operations** - Simple functions for Create, Read, Update, Delete\n- \ud83d\udd0d **Schema Inspection** - View tables and columns easily\n- \ud83d\ude80 **Unified Query Interface** - One function for all common operations\n- \u26a1 **Lightweight** - Single dependency (psycopg2-binary)\n- \ud83c\udd95 **Create Database Support** - Create a new PostgreSQL database directly\n- \ud83e\uddea **Raw SQL Execution** - Pass raw SQL directly via query()\n\n## Installation\n\n```bash\npip install psqleasy\n```\n\n## Quick Start\n\n```python\nimport psqleasy as psql\n\n# Connect to database\nwith psql.connect(\"localhost\", \"user\", \"password\", 5432, \"mydb\") as conn:\n    # Create table\n    psql.create_table(conn, \"users\", {\n        \"id\": \"SERIAL PRIMARY KEY\",\n        \"name\": \"VARCHAR(100)\",\n        \"email\": \"VARCHAR(255) UNIQUE\"\n    })\n\n    # Insert data\n    psql.insert_data(conn, \"users\", {\n        \"name\": \"John Doe\",\n        \"email\": \"john@example.com\"\n    })\n\n    # View data\n    users = psql.view_data(conn, \"users\")\n    print(users)\n```\n\n## Core Functions\n\n### Connection Management\n```python\nwith psql.connect(host, user, passwd, port, db) as conn:\n    # Your database operations\n```\n\n### CRUD Operations\n```python\n# Create table\npsql.create_table(conn, \"products\", {\n    \"id\": \"SERIAL PRIMARY KEY\",\n    \"name\": \"VARCHAR(100)\",\n    \"price\": \"DECIMAL(10,2)\"\n})\n\n# Insert data\npsql.insert_data(conn, \"products\", {\n    \"name\": \"Laptop\",\n    \"price\": 999.99\n})\n\n# View data\nproducts = psql.view_data(conn, \"products\")\n\n# Update data\npsql.update_data(conn, \"products\",\n    {\"price\": 899.99},\n    \"name = %s\", (\"Laptop\",)\n)\n\n# Delete data\npsql.delete_data(conn, \"products\",\n    \"name = %s\", (\"Laptop\",)\n)\n```\n\n### Schema Management\n```python\n# List all tables\ntables = psql.show_tables(conn)\n\n# Show table columns\ncolumns = psql.show_columns(conn, \"products\")\n\n# Drop table\npsql.drop_table(conn, \"temp_table\")\n```\n\n### Advanced Features\n```python\n# Raw SQL query via unified interface\nresult = psql.query(\n    conn,\n    \"SELECT * FROM products WHERE price > %s\",\n    params=(100,)\n)\n\n# Unified query interface for built-in operations\npsql.query(conn, 'create', table_name=\"orders\", columns={\n    \"id\": \"SERIAL PRIMARY KEY\",\n    \"product_id\": \"INTEGER\"\n})\n\norders = psql.query(conn, 'select', table_name=\"orders\")\n```\n\n### Supported operations in query()\n- `'create_db'`: Create a new database\n- `'create'`: Create a table\n- `'insert'`: Insert data\n- `'select'`: Select data\n- `'update'`: Update rows\n- `'delete'`: Delete rows\n- `'drop'`: Drop table\n- `'tables'`: Show table list\n- `'columns'`: Show column info\n- \u2705 **Supports raw SQL**: `SELECT`, `INSERT`, `UPDATE`, `DELETE`, etc.\n\n## Documentation\n\nFor complete documentation with detailed examples, please see:\n\n\ud83d\udcda https://sheikhtanvirsiddiki.github.io/psqleasy/\n\n## Contributing\n\nContributions are welcome! Please open an issue or submit a pull request.\n\n1. Fork the repository\n2. Create your feature branch (`git checkout -b feature/your-feature`)\n3. Commit your changes (`git commit -am 'Add some feature'`)\n4. Push to the branch (`git push origin feature/your-feature`)\n5. Open a pull request\n\n## License\n\nThis project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.\n\n---\n\n<p align=\"center\">\n  <i>PostgreSQL made simple for Python developers</i>\n</p>\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Ultra-simple PostgreSQL interface for Python",
    "version": "1.0.5",
    "project_urls": {
        "Bug Tracker": "https://github.com/SheikhTanvirSiddiki/psqleasy/issues",
        "Changelog": "https://github.com/SheikhTanvirSiddiki/psqleasy/releases",
        "Documentation": "https://sheikhtanvirsiddiki.github.io/psqleasy/",
        "Homepage": "https://github.com/SheikhTanvirSiddiki/psqleasy",
        "Source Code": "https://github.com/SheikhTanvirSiddiki/psqleasy"
    },
    "split_keywords": [
        "postgresql",
        " postgres",
        " database",
        " sql",
        " orm",
        " psycopg2"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "44d6a3cbfbb3ed9056c095e3ea93cc0acbe93b07af54713dc361f8d01c6391b7",
                "md5": "a13a7d01ffd3da1fdae6fb071f977aef",
                "sha256": "6adb213153e1c6069f17742972808dedd05d34573e6743a36445e03a5eb6cdf1"
            },
            "downloads": -1,
            "filename": "psqleasy-1.0.5-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "a13a7d01ffd3da1fdae6fb071f977aef",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.7",
            "size": 7295,
            "upload_time": "2025-07-22T11:14:03",
            "upload_time_iso_8601": "2025-07-22T11:14:03.976688Z",
            "url": "https://files.pythonhosted.org/packages/44/d6/a3cbfbb3ed9056c095e3ea93cc0acbe93b07af54713dc361f8d01c6391b7/psqleasy-1.0.5-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "a71b23e4c74a2fa5380708d7d266d0427e1882f5d8fbbbc542d63b0ec0aa2b78",
                "md5": "3daafaff9eb186f3e875d908995cdbd8",
                "sha256": "92f6ca1fdf0031908fdc74fe62518a75a5d6d969ec4da289ebc482b8658b8efb"
            },
            "downloads": -1,
            "filename": "psqleasy-1.0.5.tar.gz",
            "has_sig": false,
            "md5_digest": "3daafaff9eb186f3e875d908995cdbd8",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.7",
            "size": 7384,
            "upload_time": "2025-07-22T11:14:05",
            "upload_time_iso_8601": "2025-07-22T11:14:05.435479Z",
            "url": "https://files.pythonhosted.org/packages/a7/1b/23e4c74a2fa5380708d7d266d0427e1882f5d8fbbbc542d63b0ec0aa2b78/psqleasy-1.0.5.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-07-22 11:14:05",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "SheikhTanvirSiddiki",
    "github_project": "psqleasy",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "psqleasy"
}
        
Elapsed time: 0.42399s