Name | shipyard-postgresql JSON |
Version |
0.2.0
JSON |
| download |
home_page | None |
Summary | A local client for connecting and working with Postgresql Databases |
upload_time | 2024-04-02 02:49:51 |
maintainer | None |
docs_url | None |
author | wrp801 |
requires_python | <4.0,>=3.9 |
license | Apache 2.0 |
keywords |
|
VCS |
|
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
# shipyard-postgresql
PostgresClient is a Python class designed to facilitate interactions with PostgreSQL databases.
## Installation
To use PostgresClient, you'll first need to install the required dependencies:
```bash
pip install shipyard-postgresql
```
## Usage
#### Initialization
You can initialize a PostgresClient instance by providing the necessary connection parameters:
```python
postgres = PostgresClient(
user='your_username',
pwd='your_password',
host='your_host_address',
port=5432, # default PostgreSQL port
database='your_database_name',
schema='your_schema_name' # optional, defaults to public
)
```
#### Methods
`connect`
Establish an active connection to postgres. If this is not explicity called beforehand, it will be handled implicitly when the first database call is sent
```python
postgres.connect()
```
`execute_query`
Execute a SQL query on the database connection:
```python
postgres.execute_query('drop table if exists public.demo_table')
```
`upload`
Upload data from a file to a PostgreSQL table:
```python
file_path = 'path_to_your_file.csv'
table_name = 'your_table'
postgres.upload(file_path, table_name, insert_method = 'replace') # can also set to append
```
`fetch`
Fetch data from the database using a SQL query and return the results as a pandas dataframe:
```python
df = postgres.fetch('select * from public.demo_table limit 1000')
```
`close`
Close the connection once finished
```python
postgres.close()
```
Raw data
{
"_id": null,
"home_page": null,
"name": "shipyard-postgresql",
"maintainer": null,
"docs_url": null,
"requires_python": "<4.0,>=3.9",
"maintainer_email": null,
"keywords": null,
"author": "wrp801",
"author_email": "wespoulsen@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/fd/85/c4ab82718a2fdd66968d50a6c292f4d1296761fb17ed9d3b381cb73d4bbd/shipyard_postgresql-0.2.0.tar.gz",
"platform": null,
"description": "# shipyard-postgresql\n\nPostgresClient is a Python class designed to facilitate interactions with PostgreSQL databases. \n\n## Installation\n\nTo use PostgresClient, you'll first need to install the required dependencies:\n\n```bash\npip install shipyard-postgresql\n```\n\n## Usage\n#### Initialization\nYou can initialize a PostgresClient instance by providing the necessary connection parameters:\n\n```python\npostgres = PostgresClient(\n user='your_username',\n pwd='your_password',\n host='your_host_address',\n port=5432, # default PostgreSQL port\n database='your_database_name',\n schema='your_schema_name' # optional, defaults to public\n)\n```\n\n\n#### Methods \n\n`connect` \nEstablish an active connection to postgres. If this is not explicity called beforehand, it will be handled implicitly when the first database call is sent\n\n```python\npostgres.connect()\n```\n\n`execute_query`\n\nExecute a SQL query on the database connection:\n\n```python\npostgres.execute_query('drop table if exists public.demo_table')\n```\n\n`upload`\nUpload data from a file to a PostgreSQL table:\n```python\nfile_path = 'path_to_your_file.csv'\ntable_name = 'your_table'\npostgres.upload(file_path, table_name, insert_method = 'replace') # can also set to append\n```\n\n`fetch`\nFetch data from the database using a SQL query and return the results as a pandas dataframe:\n\n```python\ndf = postgres.fetch('select * from public.demo_table limit 1000')\n```\n\n`close`\nClose the connection once finished \n```python\npostgres.close()\n```\n\n\n",
"bugtrack_url": null,
"license": "Apache 2.0",
"summary": "A local client for connecting and working with Postgresql Databases",
"version": "0.2.0",
"project_urls": null,
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "a8cfb2bd9aa4b849c752ece93987451c1d658ab5568429bff1d990260ee219db",
"md5": "e5bb0876ba0632d3022b9148cd3c12de",
"sha256": "d08fd4519e4e340402d68e646b52dffed5e72d75cf5b6d4efb15b7ace0af2814"
},
"downloads": -1,
"filename": "shipyard_postgresql-0.2.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "e5bb0876ba0632d3022b9148cd3c12de",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": "<4.0,>=3.9",
"size": 8349,
"upload_time": "2024-04-02T02:49:49",
"upload_time_iso_8601": "2024-04-02T02:49:49.719622Z",
"url": "https://files.pythonhosted.org/packages/a8/cf/b2bd9aa4b849c752ece93987451c1d658ab5568429bff1d990260ee219db/shipyard_postgresql-0.2.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "fd85c4ab82718a2fdd66968d50a6c292f4d1296761fb17ed9d3b381cb73d4bbd",
"md5": "7f6cb89edb58849d311793a3c4cf87a0",
"sha256": "97e398865a4e8207734b6e9f1e91c3869c4e735cfa11add636ba433cceaa5e71"
},
"downloads": -1,
"filename": "shipyard_postgresql-0.2.0.tar.gz",
"has_sig": false,
"md5_digest": "7f6cb89edb58849d311793a3c4cf87a0",
"packagetype": "sdist",
"python_version": "source",
"requires_python": "<4.0,>=3.9",
"size": 5932,
"upload_time": "2024-04-02T02:49:51",
"upload_time_iso_8601": "2024-04-02T02:49:51.274371Z",
"url": "https://files.pythonhosted.org/packages/fd/85/c4ab82718a2fdd66968d50a6c292f4d1296761fb17ed9d3b381cb73d4bbd/shipyard_postgresql-0.2.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-04-02 02:49:51",
"github": false,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"lcname": "shipyard-postgresql"
}