Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is postgresql_psycopg2?

What is postgresql_psycopg2 ? Difference from postgresql ?

like image 449
xRobot Avatar asked May 11 '10 18:05

xRobot


People also ask

What is psycopg2 used for?

Psycopg2 is a PostgreSQL database driver, it is used to perform operations on PostgreSQL using python, it is designed for multi-threaded applications. SQL queries are executed with psycopg2 with the help of the execute() method. It is used to Execute a database operation query or command.

What is import psycopg2 in Python?

psycopg2 2.9.5 Psycopg is the most popular PostgreSQL database adapter for the Python programming language. Its main features are the complete implementation of the Python DB API 2.0 specification and the thread safety (several threads can share the same connection).

What is the difference between psycopg2 and psycopg2 binary?

psycopg2-binary and psycopg2 both give us the same code that we interact with. The difference between the two is in how that code is installed in our computer.

How do I use psycopg2 in Django?

Setting up PostgreSQL in Django To get Python working with Postgres, you will need to install the “psycopg2” module. Now, go to the below link and download and set up PostgreSQL. create a database name gfg in your Postgres server. Now its time to switch from SQLite to PostgreSQL.


2 Answers

It is (one of) the Python bindings to the PostgreSQL client library. It has nothing to do with PostgreSQL itself other than it allows Python programs to access a PostgreSQL server.

like image 141
Cromulent Avatar answered Oct 13 '22 08:10

Cromulent


When you connect to your PostgreSQL database, you most likely will use Psycopg (imported into python, allows you to write SQL code and submit it to the database). postgresql_psycopg2 belongs to Psycopg2 (second version of Psycopg), while postgresql belongs to Psycopg (the first version).

As intgr mentioned, if using with Django, Psycopg2 is recommended (Psycopg isn't supported anymore)

like image 41
SaiyanGirl Avatar answered Oct 13 '22 08:10

SaiyanGirl