Warning: Can't synchronize with repository "(default)" (Unsupported version control system "svn": No module named svn). Look in the Trac log for more information.

Ticket #1483 (closed defect: fixed)

Opened 10 years ago

Last modified 7 years ago

Make TG support SA 0.4

Reported by: paj Owned by: paj
Priority: high Milestone: 1.1.x bugfix
Component: SQLAlchemy Version: 1.0.3
Severity: normal Keywords:
Cc:

Description

SA 0.4 has some backwards-incompatible changes. We need to make sure TG 1.0 at least basically works, and look harder at changing documentation and such for TG 1.1 and 2.

Attachments

TurboGears-1.0.3.2dev_r3487_database.py.diff Download (998 bytes) - added by renier 10 years ago.
Elixir-0.4.0___init__.py.diff Download (678 bytes) - added by renier 10 years ago.
Elixir-0.4.0_entity.py.diff Download (688 bytes) - added by renier 10 years ago.

Change History

comment:1 Changed 10 years ago by paj

Ok, good news is that there only seems to be one essential change - a reference to sqlalchemy.create_session that needs to become sqlalchemy.orm.create_session. I've made some changes to the unit tests as well, so they pass. Changes committed in [3407] for 1.0 branch and [3408] for 1.1.

I think there are more issues lurking around though, so I'm going to leave this ticket open.

comment:2 Changed 10 years ago by paj

  • Component changed from TurboGears to SQLAlchemy

comment:3 Changed 10 years ago by paj

We should probably add "from sqlalchemy.orm import *" to the top of the quickstart templates.

comment:4 Changed 10 years ago by paj

Need to fix the deprecation warnings as well, although a change I'm about to commit to SA will sort most of these.

comment:5 Changed 10 years ago by paj

Need to make sure that when sqlalchemy.echo=1, SQL is actually printed - seems not to be at the mo.

comment:6 Changed 10 years ago by paj

  • Priority changed from normal to high

Some changes may be necessary to visit and identity (e.g. user.get -> user.query.get)

We need different quickstarts for 0.3 and 0.4 (aaaggh!) as 0.3 uses assign_mapper, deprecated in 0.4.

Need to test carefully that Elixir works (and make unit tests) - some problems have been reported.

comment:7 follow-up: ↓ 8 Changed 10 years ago by renier

To get Elixir 0.4 and Turbogears-1.0.3.2, I had to make the following changes: Elixir's init.py - Make it use scoped_session instead of SessionContext? to avoid deprecation warnings in SQLAlchemy 0.4. Elixir's entity.py - Define a get method for the Entity class to avoid errors in TG's identity management. TG's database.py - Make it use elixir instead of the obsolete active mapper, plus a change to use session.context.registry, instead of session.context.current, since the change of using scoped_session.

I'm discussing the Elixir changes in this thread:  http://groups.google.com/group/sqlelixir/browse_thread/thread/d97bc371b7d16f95

I'm attaching all patch files for reference, though I know the TG patch is the only one relevant in this place. However, its relevance depends on the Elixir patches.

comment:8 in reply to: ↑ 7 Changed 10 years ago by renier

--Reposting comment 7, now that I know you can wiki format--

To get Elixir 0.4 and Turbogears-1.0.3.2, I had to make the following changes:

  • Elixir's init.py - Make it use scoped_session instead of SessionContext?? to avoid deprecation warnings in SQLAlchemy 0.4.
  • Elixir's entity.py - Define a get method for the Entity class to avoid errors in TG's identity management.
  • TG's database.py - Make it use elixir instead of the obsolete active mapper, plus a change to use session.context.registry, instead of session.context.current, since the change of using scoped_session.

I'm discussing the Elixir changes in this thread:  http://groups.google.com/group/sqlelixir/browse_thread/thread/d97bc371b7d16f95

I'm attaching all patch files for reference, though I know the TG patch is the only one relevant in this place. However, its relevance depends on the Elixir patches.

Changed 10 years ago by renier

Changed 10 years ago by renier

Changed 10 years ago by renier

comment:9 Changed 10 years ago by renier

Tickets have been created for the elixir patches at:

comment:10 Changed 10 years ago by renier

 http://elixir.ematia.de/trac/ticket/8 has been fixed and closed in Elixir trunk

comment:11 Changed 9 years ago by paj

Ok, some progress: I've made a change to activemapper and turbogears to fix most of the deprecation warnings. TG is now actually using scoped_session, so it needed some other changes.

On quickstart and visit/identity - it turns out no changes are necessary, although this hasn't been heavily tested. These modules use plain SA, not even assign_mapper, so they don't see those changes.

This leaves us to sort out logging, Elixir and documentation. I'll look at this as I have time.

comment:12 Changed 9 years ago by paj

Need to merge these changes into the 1.1 branch as well

comment:13 Changed 9 years ago by paj

Some quick tests show Elixir working fine with trunk Elixir and trunk TG, and both SA 0.3.10 and 0.4. Thanks for sorting this renier!

I've started some new documentation  http://docs.turbogears.org/1.0/RoughDocs/SQLAlchemy

The logging problems are apparently due to "echo" being removed, an alternate configuration is used.

comment:14 Changed 9 years ago by paj

Ok, docs are pretty much done, including logging. And I've made a change to the dev.cfg template for this.

Once I've merged the changes into 1.1 (which is a fair task), this ticket will be ready to close off.

comment:15 Changed 9 years ago by paj

Changes are now merged into the 1.1 branch, that should be it!

I'll leave this ticket open for a week or so in case of problems.

comment:16 Changed 9 years ago by paj

  • Status changed from new to closed
  • Resolution set to fixed

Ok, no-one has complained yet! I notice Roger checked in some paginate fixes as well.

comment:17 Changed 7 years ago by chrisz

  • Milestone changed from __unclassified__ to 1.1.x bugfix
Note: See TracTickets for help on using tickets.