Skip to main content
Help us improve PyPI by participating in user testing. All experience levels needed!

A Library to communicate with postgres from python

Project description

Postgres python
---------------
A simple api to read, write, delete and update in a postgres database

Installation : Linux/Mac
---------------

.. code-block:: bash

$ pip install pg_python


Server Initialization
---------------

.. code-block:: bash

$ from pg_python.pg_python import *
$ pgs = pg_server(db_name, username, password, host_address)

Schema Definition (Optional)(Not available)
---------------

.. code-block:: bash

$ schema_map = Schema()
$ pgs.add_schema(db_name, schema_map)

Read operation
---------------
Return value is a list of dictionaries.
Every dictionary is representative of the row that is fetched.
Each dictionary's key is the same as the column name fetched.


.. code-block:: bash

$ value_list = read(table_name, keys_to_get_dict, where_kv_dict, limit, order_by, order_type, operator_string)

**Parameter information :**

- keys_to_get_dict(a list of column names to fetch)
- where_kv_dict(a dictionary to specify the 'Where' clause)

**Example usage :**
print pg_python.read("mock_table", ['column2','column3'], {"column_1":'55'})
Resulting query: SELECT column2, column3 FROM mock_table WHERE column1 = %s, ['55']

Sample output: [{'column2': 'column_data_A', 'column3': 'column_data_Z'}, {'column2': 'column_data_P', 'column3': 'column_data_Q'}]

Write operation
---------------

.. code-block:: bash

$ write(table_name, kv_dict)

Overwrite operation
---------------

.. code-block:: bash

$ write(table_name, kv_dict)

Update operation
---------------

.. code-block:: bash


$ update(table, update_kv_map, where_kv_map)

Delete operation
---------------

.. code-block:: bash


$ delete(table, where_kv_map, single_row)

Project details


Release history Release notifications

This version
History Node

1.500

History Node

1.422

History Node

1.421

History Node

1.420

History Node

1.411

History Node

1.410

History Node

1.406

History Node

1.405

History Node

1.403

History Node

1.402

History Node

1.401

History Node

1.400

History Node

1.390

History Node

1.387

History Node

1.386

History Node

1.384

History Node

1.383

History Node

1.382

History Node

1.381

History Node

1.380

History Node

1.363

History Node

1.38

History Node

1.37

History Node

1.36

History Node

1.34

History Node

1.33

History Node

1.32

History Node

1.31

History Node

1.30

History Node

1.29

History Node

1.28

History Node

1.27

History Node

1.26

History Node

1.25

History Node

1.24

History Node

1.22

History Node

1.21

History Node

1.20

History Node

1.19

History Node

1.18

History Node

1.17

History Node

1.16

History Node

1.15

History Node

1.14

History Node

1.13

History Node

1.12

History Node

1.11

History Node

1.10

History Node

1.9

History Node

1.8

History Node

1.7

History Node

1.6

History Node

1.5

History Node

1.4

History Node

1.3

History Node

1.2

History Node

1.1

History Node

1.0

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Filename, size & hash SHA256 hash help File type Python version Upload date
pg_python-1.500-py2.7.egg (62.8 kB) Copy SHA256 hash SHA256 Egg 2.7 Jun 17, 2018
pg_python-1.500.tar.gz (14.2 kB) Copy SHA256 hash SHA256 Source None Jun 17, 2018

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging CloudAMQP CloudAMQP RabbitMQ AWS AWS Cloud computing Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page