473,657 Members | 2,407 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Postgresql - Preferred Python Library

Hi All
I have noticed that there are a numbe rof client libraries for connecting to
Postgres.

Can anyone tell me what is the recommended Python library for database
connections

many thanks
Jul 18 '05 #1
6 2268
On 2004-09-10, Matt Goodall <ma**@pollenati on.net> wrote:
I've just started experimenting with psycopg2
(http://wiki.initd.org/Projects/PsycopgTwo) and it's looking good.

As far as I know, psycopg2 is the only DB-API 2.0 implementation for
PostgreSQL that uses Python 2.3's datetime types by default.

ooh, aah. :o)

Yes, the datetime handling in the older psycopg was getting on my
nerves... Native datetime is going to make things much nicer.

That said, psycopg works very well for me.

The only other thing that is a bit strange is passing array
types in to the database. I have been using this:

alist = ['foo', 'bar']
query = 'SELECT ARRAY%(alist)s'
execute(query, locals())

It works perfectly well, but it seems a bit strange...

Jul 18 '05 #2
On 2004-09-09, Graeme Matthew <gr************ @contrado.com.a u> wrote:
Can anyone tell me what is the recommended Python library for database
connections


My preference is psycopg, but I also try to test with the standard one that
comes with postgres (the DBAPI module is pgdb) and pyPgSQL.

Dave Cook

Jul 18 '05 #3
Cliff Wells <cl************ @comcast.net> wrote:
On Thu, 2004-09-09 at 16:21, Graeme Matthew wrote:

I have noticed that there are a numbe rof client libraries for connecting to
Postgres.

Can anyone tell me what is the recommended Python library for database
connections


I'd strongly recommend psycopg. I've used both psycopg and the pgsql
module and found psycopg to be much more stable.


So have I, and I wish I could quantify the difference. It's not like
pyPgSQL crashes on me every day, but there's something intangible about
psycopg that appeals to me. I've switched to it everywhere.
--
- Tim Roberts, ti**@probo.com
Providenza & Boekelheide, Inc.
Jul 18 '05 #4
On Fri, 2004-09-10 at 23:04 -0700, Tim Roberts wrote:
Cliff Wells <cl************ @comcast.net> wrote:
On Thu, 2004-09-09 at 16:21, Graeme Matthew wrote:

I have noticed that there are a numbe rof client libraries for connecting to
Postgres.

Can anyone tell me what is the recommended Python library for database
connections


I'd strongly recommend psycopg. I've used both psycopg and the pgsql
module and found psycopg to be much more stable.


So have I, and I wish I could quantify the difference. It's not like
pyPgSQL crashes on me every day, but there's something intangible about
psycopg that appeals to me. I've switched to it everywhere.


My tangible difference was that a script I have that inserts about
40,000 records into a table (as a single transaction) could never
complete (hard crash) with the standard pgsql module but completes
without a hitch with psycopg. Other than that I don't have a problem
with it <wink>.

Cliff

--
Cliff Wells <cl************ @comcast.net>

Jul 18 '05 #5
> I've just started experimenting with psycopg2
(http://wiki.initd.org/Projects/PsycopgTwo) and it's looking good.


Matt,

on my research of Python connectors to postgresql I also saw psycopg. I had
to stop further testing because no win32 binaries were available.

My knowledge grew since then, and meanwhile I was able to compile pyPgSQL
myself using the instructions and MingW32.

I was not able to compile psycopg2 with MingW32. I assume you use it
outside windows, or do you have any binaries for Win32 and psycopg? The
type issue sounds promising, would like to test it ..

Harald
Jul 18 '05 #6
Harald Massa wrote:
I've just started experimenting with psycopg2
(http://wiki.initd.org/Projects/PsycopgTwo) and it's looking good.

Matt,

on my research of Python connectors to postgresql I also saw psycopg. I had
to stop further testing because no win32 binaries were available.


They are!
Look here: http://www.stickpeople.com/projects/...opg/index.html

That link is on their site http://initd.org/software/initd/psycopg ....
--Irmen
Jul 18 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
2166
by: Otis Green | last post by:
Vote for or against a new newsgroup proposal. To summarize what you need to do, just send an empty e-mail to postgresql-ballot@netagw.com You will receive a ballot by e-mail. Follow the instructions and vote. _______________________________________________________________________ FIRST CALL FOR VOTES (of 2)
2
2066
by: Dave Haynes | last post by:
Hi, This is just as much a PostgreSQL question as a Python one, but here goes... I've been trying to port the psycopg interface to a Win2K client (server runs FreeBSD). I'm using MinGW32 rather than CygWin, and having trouble compiling the libpg library as a DLL. I started off with the following:
3
1545
by: Steve | last post by:
Hi, Can someone please point me out to some module/library for using PostgreSQL from python? Perhaps a tutorial as wel? Thanks! Steve
59
7156
by: Jeff Bowden | last post by:
For ease of configuration and other reasons, I would like for my single-user GUI app to be able to use postgresql in-process as a library accessing a database created in the users home directory. I think I could possibly get what I want by launching a captive copy of postmaster with appropriate args but it seems conceptually cleaner to not have a seperate process at all. Has anyone tried to do anything like this? I've looked at sqlite...
19
18622
by: Mike Cox | last post by:
Has anyone created something like that for Postgresql? It would be really handy to encrypt credit card numbers and other information so it stays secure. If no one has created anything such as this, I am going to code up something quite soon, but if it already exists, there is no need for me to reinvent the wheel, so speak up! It is a law in places such as the EU that many types of data must be encrypted if the database is compromised.
1
1345
by: Jerry LeVan | last post by:
Is it possible to build the python postgresql support library on Mac OSX 10.3.5 with the default python install? Adding "--with-python" gets an error message about libpython not being a shared library when attempting to build postgresql. (pg 7.4.5) Thanks for any pointers. Jerry
4
1682
by: Bill Jackson | last post by:
Is there a preferred random library? scipy.random random Besides scipy's library returning ndarrays, is there any other advantage/disadvantage?
4
1517
by: Ben Sizer | last post by:
I've been looking for a Windows version of a library to interface to PostgreSQL, but can only find ones compiled under Python version 2.4. Is there a 2.5 build out there? -- Ben Sizer
0
1616
by: David Michael Schruth, | last post by:
Hi, I am sort of in a jam here. I am using the PsycoPG2 library to read data out of a windows XP based PostGIS / PostGreSQL database but I am apparently unable to write (update or insert) even though I am able to read (select) I am using PsycoPG2 2.0.6 (psycopg2-2.0.6.win32-py2.5-pg8.2.4- release.exe ) with Python 2.5 (python-2.5.msi)
0
8411
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8323
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8838
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8739
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8513
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
6176
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4173
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4329
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
1732
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.