PYTHON, ODBC

Started by Nonameabout 21 years ago8 messagesgeneral
Jump to latest
#1Noname
mstory@uchicago.edu

We're looking into building a front end for our database in python.
The database in question is an educational database, that generates
new tables for each teacher, class and student. Was wondering if
anyone had any recommendations for similar projects to look at,
resources, and general information about coding a python front end,
how to use the ODBC python libraries etc.

Thanks, matt

#2Pierre-Frédéric Caillaud
lists@boutiquenumerique.com
In reply to: Noname (#1)
Re: PYTHON, ODBC

Never used ODBC with Python, but if you want to use Postgres, I'd
strongly recommend psycopg which I find the nicest and fastest postgres
adapter (certainly a lot better than Pygresql and pypgsql)

Regards

On Sat, 8 Jan 2005 18:01:01 -0600, <mstory@uchicago.edu> wrote:

Show quoted text

We're looking into building a front end for our database in python.
The database in question is an educational database, that generates
new tables for each teacher, class and student. Was wondering if
anyone had any recommendations for similar projects to look at,
resources, and general information about coding a python front end,
how to use the ODBC python libraries etc.

Thanks, matt

---------------------------(end of broadcast)---------------------------
TIP 2: you can get off all lists at once with the unregister command
(send "unregister YourEmailAddressHere" to majordomo@postgresql.org)

#3Noname
mstory@uchicago.edu
In reply to: Pierre-Frédéric Caillaud (#2)
Re: PYTHON, ODBC

I've looked into pshycho pg, it appears to be the best option, my later question
now remains, what documentation or examples would be useful in developing a
completely proprietary front end written in python. Any help finding useful
examples or documentation would be greatly appreciated.

thanks,
matt

Quoting Pierre-Fr�d�ric Caillaud <lists@boutiquenumerique.com>:

Show quoted text

Never used ODBC with Python, but if you want to use Postgres, I'd
strongly recommend psycopg which I find the nicest and fastest postgres
adapter (certainly a lot better than Pygresql and pypgsql)

Regards

On Sat, 8 Jan 2005 18:01:01 -0600, <mstory@uchicago.edu> wrote:

We're looking into building a front end for our database in python.
The database in question is an educational database, that generates
new tables for each teacher, class and student. Was wondering if
anyone had any recommendations for similar projects to look at,
resources, and general information about coding a python front end,
how to use the ODBC python libraries etc.

Thanks, matt

---------------------------(end of broadcast)---------------------------
TIP 2: you can get off all lists at once with the unregister command
(send "unregister YourEmailAddressHere" to majordomo@postgresql.org)

---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives?

http://archives.postgresql.org

#4Pierre-Frédéric Caillaud
lists@boutiquenumerique.com
In reply to: Noname (#3)
Re: PYTHON, ODBC

completely proprietary front end written in python. Any help finding
useful

What does "a completely proprietary front-end in python" means ?

#5Noname
mstory@uchicago.edu
In reply to: Pierre-Frédéric Caillaud (#4)
Re: PYTHON, ODBC

----- Forwarded message from Matthew Story <matthewstory@gmail.com> -----
Date: Sun, 9 Jan 2005 12:40:36 -0600
From: Matthew Story <matthewstory@gmail.com>
Reply-To: Matthew Story <matthewstory@gmail.com>
Subject: Re: [GENERAL] PYTHON, ODBC
To: Pierre-Fr�d�ric Caillaud <lists@boutiquenumerique.com>

we won't be using any tools aside from psycho pg, no gui application
frameworks, ie we're not using zope, ruby on rails, etc. The front
end will only work for this particular database. This has come about
due to the complicated nature of the database, and inability of zope
to do what we need, and the problems with overhead we've been
experiencing with rails due to the size of the database. Hope this
clears things up a bit.

thanks,
matt

On Sun, 09 Jan 2005 14:56:57 +0100, Pierre-Fr�d�ric Caillaud
<lists@boutiquenumerique.com> wrote:

completely proprietary front end written in python. Any help finding
useful

What does "a completely proprietary front-end in python" means ?

----- End forwarded message -----

#6Matthew Story
matthewstory@gmail.com
In reply to: Pierre-Frédéric Caillaud (#4)
Re: PYTHON, ODBC

we won't be using any tools aside from psycho pg, no gui application
frameworks, ie we're not using zope, ruby on rails, etc. The front
end will only work for this particular database. This has come about
due to the complicated nature of the database, and inability of zope
to do what we need, and the problems with overhead we've been
experiencing with rails due to the size of the database. Hope this
clears things up a bit.

thanks,
matt

On Sun, 09 Jan 2005 14:56:57 +0100, Pierre-Frédéric Caillaud
<lists@boutiquenumerique.com> wrote:

Show quoted text

completely proprietary front end written in python. Any help finding
useful

What does "a completely proprietary front-end in python" means ?

#7Pierre-Frédéric Caillaud
lists@boutiquenumerique.com
In reply to: Matthew Story (#6)
Re: PYTHON, ODBC

due to the complicated nature of the database, and inability of zope

Well, I've found that Zope is very good to do a few things, and very bad
at the rest.

to do what we need, and the problems with overhead we've been
experiencing with rails due to the size of the database. Hope this

I like psycopy because selects with a lot of rows are processed
efficiently.

Look at the pydo library in the skunkweb project (google !)

I'd advise you to start writing a base class for your database object
(class DbObject) with a set of methods for setting instance methods from
query results. SELECT * then use cursor.dictfetchall() which preserves the
fields names !
Add methods for inserting and updating.
Add a mapping of fields to type converters (which are functions) to
convert non-standard types like arrays to python lists if you need them.

Then derive your DbObject class for each table, with class variables
containing the field names and types converters, which will be used by the
base class. This way you can have a derived class with almost no code.

Enjoy !

#8Matthew Story
matthewstory@gmail.com
In reply to: Pierre-Frédéric Caillaud (#7)
Re: PYTHON, ODBC

thanks for the advice,

matt

On Sun, 09 Jan 2005 20:47:08 +0100, Pierre-Frédéric Caillaud
<lists@boutiquenumerique.com> wrote:

Show quoted text

due to the complicated nature of the database, and inability of zope

Well, I've found that Zope is very good to do a few things, and very bad
at the rest.

to do what we need, and the problems with overhead we've been
experiencing with rails due to the size of the database. Hope this

I like psycopy because selects with a lot of rows are processed
efficiently.

Look at the pydo library in the skunkweb project (google !)

I'd advise you to start writing a base class for your database object
(class DbObject) with a set of methods for setting instance methods from
query results. SELECT * then use cursor.dictfetchall() which preserves the
fields names !
Add methods for inserting and updating.
Add a mapping of fields to type converters (which are functions) to
convert non-standard types like arrays to python lists if you need them.

Then derive your DbObject class for each table, with class variables
containing the field names and types converters, which will be used by the
base class. This way you can have a derived class with almost no code.

Enjoy !