[SQLObject] specifying a connection object at runtime.
SQLObject is a Python ORM.
Brought to you by:
ianbicking,
phd
|
From: Markus J. <mar...@ya...> - 2004-09-21 20:33:59
|
Hola
I have another SQLObject question.
this is my code:
---
from sqlobject import *
class Author(SQLObject):
firstName = StringCol()
lastName = StringCol()
class AuthorTable:
def __init__(self, connection):
Author._connection = connection
Author.createTable(ifNotExists=True)
def createAuthorTable(connection):
AuthorTable(connection)
createAuthorTable(connectionForURI('mysql://markus:eagle@localhost/books'))
a1 = Author(firstName = "J.R.R.", lastName =
"Tolkien")
----
the reason for this is that I want a generic modul
about authors and I want to specify the connection
Object at runtime, for example when I want
to use PostgreSQL.
the code works but I would like to know
if it has any flaws I do not see.
the reason for my question is, that I am
preparing an article about Object Relational Mapping
in Python for a german magazine. and
the main focus will be on SQLObject with 2 or
3 simple Examples.
I really like SQLObject and maybe the article
helps to get more people interested in SQLObject.
and I do not want to have any serious errors
in my examples.
thanks
regards
Markus
> >
___________________________________________________________
Gesendet von Yahoo! Mail - Jetzt mit 100MB Speicher kostenlos - Hier anmelden: http://mail.yahoo.de
|