Giter Club home page Giter Club logo

pypostgresin's Introduction

PyPostgresIn

This library is needed to quickly start working with Postgres in python. The library provides the ability to skip creating SQL queries and simply load data into an existing table, or create table and load data into it while saving data types, all in one line of code

Prerequirements

  • Python >= 3.6
  • PostgreSQL server >= 7.4
  • PostgreSQL client library >= 9.1

Installation

pip install -i https://test.pypi.org/simple/ PyPostgresIn==0.0.4
pip install -r requirements.txt

Examples

This is a short example showing how to use PyPostgresIn
import datetime
import psycopg2
from PyPostgresIn import PyPostgresIn  # import lib

connection = psycopg2.connect(user="postgres",  # just use your connection info
                              password="admin",
                              host="127.0.0.1",
                              port="5432",
                              database="planes")
# IMPORTANT!! If table not exist, then the names of the variables will become the names of the columns 
# (WARNING:Don't forget to name variables correctly) and they will receive the types of the variables
# (Supported types: float as float8, str as text, int as int8, datetime as timestamp, bool as bool) 
table_name = 'Falcon_8'
icao24 = 17356
time_position = datetime.datetime.now()
on_ground = False
origin_country = 'Russia'
velocity = 1234.56

PyPostgresIn.sql_insert(connection, table_name,  # Your connection and table_name variables
                        PyPostgresIn.get_all(locals(),
                                             # Any dictionary that containing the current scope's and name of 
                                             # variables like global() WARNING!! Make sure that there are no extra 
                                             # variables in the dictionary with the same values as the transferred variables 
                                             icao24, origin_country, time_position, on_ground,
                                             velocity))  # Any count of your variables to table


Release not stable and constantly updated, follow to get the latest releases

pypostgresin's People

Contributors

andrewodn avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.