# RemotePostgres
RemotePostgres is a way to easily access a remote Postgres database and perform queries, including SELECT and INSERT operations
See below for examples of how to use
```python
from remote_postgres import RemotePostgres
import mysecrets
db = RemotePostgres(f'postgres://{mysecrets.pg_user}:{mysecrets.pg_password}@{mysecrets.pg_host}:{mysecrets.pg_port}/{mysecrets.pg_database}')
```
```python
db.get_counts()
```
[{'tmp_1347844423': 0}, {'Employee': 0}, {'tmp_1170648801': 0}]
```python
db.con.cursor().execute("""CREATE TABLE "Shipper" ("Id" INTEGER, "CompanyName" TEXT, "Phone" TEXT) """)
```
```python
new_records = [{'Id': 1, 'CompanyName': 'Speedy Express', 'Phone': '(503) 555-9831'},
{'Id': 2, 'CompanyName': 'United Package', 'Phone': '(503) 555-3199'},
{'Id': 3, 'CompanyName': 'Federal Shipping', 'Phone': '(503) 555-9931'},
{'Id': 4, 'CompanyName': 'Speedy Express', 'Phone': '(503) 555-9831'},
{'Id': 5, 'CompanyName': 'United Package', 'Phone': '(503) 555-3199'},
{'Id': 6, 'CompanyName': 'Federal Shipping', 'Phone': '(503) 555-9931'}]
```
```python
db.insert('Shipper', new_records)
```
```python
db.select('SELECT * FROM "Shipper"')
```
[{'Id': 1, 'CompanyName': 'Speedy Express', 'Phone': '(503) 555-9831'},
{'Id': 2, 'CompanyName': 'United Package', 'Phone': '(503) 555-3199'},
{'Id': 3, 'CompanyName': 'Federal Shipping', 'Phone': '(503) 555-9931'},
{'Id': 4, 'CompanyName': 'Speedy Express', 'Phone': '(503) 555-9831'},
{'Id': 5, 'CompanyName': 'United Package', 'Phone': '(503) 555-3199'},
{'Id': 6, 'CompanyName': 'Federal Shipping', 'Phone': '(503) 555-9931'}]
```python
cur = db.con.cursor()
cur.execute("""DELETE FROM "Shipper" WHERE "Id" > 3""")
db.con.commit()
```
```python
db.generate_create_table('Shipper', new_records)
```
'CREATE TABLE "Shipper" ("Id" TEXT, "CompanyName" TEXT, "Phone" TEXT)'
```python
db.con.cursor().execute("""DROP TABLE "Shipper" """)
db.con.commit()
```
```python
del db # Close the connection
```
Metadata
Release files for remote-postgres 1.2.5
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| remote_postgres-1.2.5.tar.gz | 2.9 kB | Without provenance | Details for remote_postgres-1.2.5.tar.gz |
Release files / remote_postgres-1.2.5.tar.gz
| Download URL | remote_postgres-1.2.5.tar.gz |
|---|---|
| Size | 2.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
890908dc0448499a517a26efdadf141636e5a4fb11e9f0bd6b0863b019525f5e
|
|
BLAKE2b-256 checksum How to use checksums |
2b760efcdbe1301341b092ce2d5528bb603bbe7dfb24a823f043835e9fed033c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.2.0 pkginfo/1.4.2 requests/2.23.0 setuptools/40.6.2 requests-toolbelt/0.9.1 tqdm/4.28.1 CPython/3.7.1
|
Security for remote-postgres 1.2.5
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.