logo       

Understanding type mapping in Psycopg2: msg#00005

Subject: Understanding type mapping in Psycopg2
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi

I am just starting to look at how to port the GeoTypes package to Psycopg2. 

I have read the explanation on the wiki about MicroProtocols and had a look at 
the adaptor PEP. I think I understand what is going on but I don't see how 
new adaptors are registered. The example "examples/useradapter.py" does not 
appear to be in psycopg-1.99.3.

The GeoTypes package makes use of the "psycopg.register_type()" mechanism to 
provide 'readers' for the PostGIS types and then uses classes for each of the 
PostGIS types that have __str__() methods that provide 'writers' when used as 
bound variables.

Presumably I would need to make my PostGIS python classes implement the 
ISQLQuote interface for them to work well in Psycopg2. I think is quite 
straightforward. But this only covers the 'writer' side, i.e. passing objects 
to execute() as bound variables. 

Are there any changes to the 'reader' side i.e. the nature of the parameters 
passed to "psycopg.register_type()"?

Many thanks

Richard



- -- 
QinetiQ                                  
B009 Woodward Building
St. Andrews Road
Malvern
Worcs WR14 3PS
Jabber: RichardTaylor-/eSpBmjxGS4dnm+yROfE0A@xxxxxxxxxxxxxxxx
PGPKey: http://search.keyserver.net:11371/pks/lookup?op=get&search=0xA7DA9FD9
Key fingerprint = D051 A121 E7C3 485F 3C0E  1593 ED9E D868 A7DA 9FD9
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.1 (GNU/Linux)

iD8DBQFAdPrU7Z7YaKfan9kRAsAKAKCFcsS7Ck3s8Yylr39BkUJaRiJHcwCdE+N1
O29l7pH2hawxK7BEThbqlQU=
=qMln
-----END PGP SIGNATURE-----


<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

Recently Viewed:
boot-loaders.gr...    php.pear.genera...    debugging.valgr...    kde.redhat.user...    text.xml.xsl.ge...    culture.languag...    hardware.microc...    java.servicemix...    redhat.release....    web.zope.plone....    user-groups.lin...    opendarwin.webk...    video.mjpeg.use...    sysutils.bcfg2....    encryption.gpg....    lx-office.devel...    xfree86.forum/2...    mail.mutt.devel...    acpi.devel/2003...    qnx.openqnx.dev...    network.irc.irs...    freebsd.devel.m...   
Home | blog view | USPTO Patent Archive | advertise | OSDir is an inevitable website. super tiny logo

Free Magazines

Cisco News
Receive a free quarterly e-newsletter with exclusive articles on how Cisco IT uses its own products and solutions to enable the business.
subscribe

Systems Management News, the newspaper for IT systems administration and data center managers! Each issue of Systems Management News is chock-full of news and analysis to help you understand what's happening in your field.
subscribe

The Enterprise Newsweekly eWeek is the essential technology information source for builders of e-business.
subscribe

Oracle Magazine Oracle Magazine contains technology strategy articles, sample code, tips, Oracle and partner news, how to articles for developers and DBAs, and more. Oracle (NASDAQ: ORCL) is the world's largest enterprise software company.
subscribe

Total Telecom Total Telecom is "The Economist of the communications industry".
subscribe