Hello guys,

I have recently made a decision to start using the Pyramid (python web
framework) for my projects from now on.

I have also decided to use SQLalchemy, and I want to use raw MySQL
(personal reasons) but still keep the ORM features.

The first part of the code in models.py reads:

DBSession =
scoped_session(sessionmaker(extension=ZopeTransactionExtension()))
Base = declarative_base()

Now from here how do I exectue a query for CREATE TABLE using raw
MySQL.

the traditional SQLalchemy way would 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

I have tried the following:

DBSession.execute( """
    CREATE TABLE artwork (
        artwork_id int not null primary key auto_increment,
        artist_id int not null,
        cat_id int not null,
        artwork_img_sml varchar(50),
        artwork_img varchar(50),
        title varchar(200),
        description varchar(200),
        size varchar(10),
        price decimal(9,2)
    );
"""
)

and recieve the following error: UnboundExecutionError: Could not
locate a bind configured on SQL expression or this Session

Please keep in mind I am new to Pylons/Pyramid and SQLAlchemy,
therefor my lack of understanding how simple things are working at the
moment.

-- 
You received this message because you are subscribed to the Google Groups 
"pylons-devel" group.
To post to this group, send email to pylons-devel@googlegroups.com.
To unsubscribe from this group, send email to 
pylons-devel+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/pylons-devel?hl=en.

Reply via email to