python - Raw MySQL with SQLAlchemy using Pyramid framework -


i have made decision start using pyramid (python web framework) projects on.

i have decided use sqlalchemy, , want use raw mysql (personal reasons) still keep orm features.

the first part of code in models.py reads:

dbsession = scoped_session(sessionmaker(extension=zopetransactionextension())) base = declarative_base() 

now here how exectue query create table using raw mysql.

the traditional sqlalchemy way be:

class page(base):   __tablename__ = 'pages'   id = column(integer, primary_key=true)   name = column(text, unique=true)   data = column(text)  def __init__(self, name, data):     self.name = name     self.data = data 

dbsession.execute('create table ....') 

have @ sqlalchemy.text() parametrized queries.


Comments

Popular posts from this blog

apache - Add omitted ? to URLs -

redirect - bbPress Forum - rewrite to wwww.mysite prohibits login -

php - How can I stop spam on my custom forum/blog? -