Hi,

1. I think that you should check the documentation of TG2.
And check out your model/__init__.py
Something like that should work:
maker = sessionmaker(autoflush=False, autocommit=False,
                     extension=ZopeTransactionExtension())
DBSession = scoped_session(maker)
DeclarativeBase = declarative_base()
metadata = DeclarativeBase.metadata
import elixir
elixir.session = DBSession
elixir.metadata = metadata
def init_model(engine):
    """Call me before using any of the tables or classes in the model."""
    DBSession.configure(bind=engine)
from yourproject.model.Entities import *
elixir.setup_all()

2. You will (are predicted to) run into a problem with a newer version of SQLAlchemy. Some classes are defined somewhere else than in earlier versions. Thus the last version of Elixir can not import that class from SQLalchemy. You should change that in the source of Elixir (to set the correct "path" (import statement) to that class). I do not find it now and can not remember. If this happens and you are at that step and can not solve, let me know.

3. I have been a big fun of Elixir. However, I think that it is not developed actively. In addition SQLAlchemy has developed a lot in the last 10 years. So try to get rid of Elixir and use pure SQLAlchemy.

Bests,
Tamas

On 05/04/2017 08:51 AM, D R Dinesh Kumar wrote:
Hi All,

We were using Elixir with TG1 and we have recently migrated to TG2.
Finding difficulty in hooking the TG2 session to Elixir session and
metadata.

we were using the following statement in TG1 for the hook:
from turbogears.database import metadata as __metadata__
from elixir import sqlalchemy
__metadata__ = sqlalchemy.MetaData()
__engine__ = sqlalchemy.create_engine("...')
__metadata__.engine = __engine__
setup_all()
create_all()

The above code was doing very good and didnt find any issues at all.

Can you please help how to do the same in TG2? turbogears.database is
not available anymore.

With Regards,
Dinesh.

--
You received this message because you are subscribed to the Google
Groups "TurboGears" group.
To unsubscribe from this group and stop receiving emails from it, send
an email to [email protected]
<mailto:[email protected]>.
To post to this group, send email to [email protected]
<mailto:[email protected]>.
Visit this group at https://groups.google.com/group/turbogears.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups 
"TurboGears" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/turbogears.
For more options, visit https://groups.google.com/d/optout.

Reply via email to