Florent,

Yes, I figured the problem. I was using an old version of SqlAlchemy.
Now I created a project from scratch to use SqlAlchemy and not
SqlObject.

However, I have one issue:

In addition to SQLite, I also have a preexisitng postgresql db that my
TG application has to get access to.

When I was using SqlObject, I did the following:

hub = PackageHub('projectname')
__connection__ = hub

conn = connectionForURI("postgres://username:[EMAIL PROTECTED]:5432/
persondb")

class Person(SQLObject):
    _connection = conn
    class sqlmeta:
        fromDatabase = True

Now, how do I point to a preexisitng postgresql db with sqlalchemy?

Thanks.


On Oct 2, 3:08 pm, "Florent Aide" <[EMAIL PROTECTED]> wrote:
> On 10/2/07, vrs762 <[EMAIL PROTECTED]> wrote:
>
> > tg-admin quickstart --identity projectname
>
> > I'm wondering if that is the issue?
>
> You are using SQLObject here. There is not such thing as a session in SO.
> But you could do:
> ------------------------------------------------
> from yourapp.model import hub
> from yourapp.model import Person
>
> hub.begin()
> e = Person.selectBy(name=inputname)
> e.address = newaddress
> hub.commit()
> ------------------------------------------------
>
> as a side note I changed your import from a relative one (from model
> ...) to an absolute one (from yourapp.model ...) which is the
> recommended way to use in Python land.
>
>
>
> > Should I just create a new project?
>
> > tg-admin quickstart -s -i --identity projname
>
> It depends if you want to use SQLAlchemy or not (This is definitely
> the future now).
> If you are not too deep in your project already it might by worth
> starting a new project from scratch (maybe even try the beta... ) and
> use SQLAlchemy.
>
> I hinted the beta because if you use the above mentioned command line
> with the beta you will get a model which is SA 0.4 ready (and TG 1.1
> ready).
>
> Regards,
> Florent.


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"TurboGears" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/turbogears?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to