I have a MySQL VARCHAR column, but I'd like to get ENUM-like behavior at
the ORM level. I'm using the declarative style. Here's what I've got so far:
language = Column(Enum('en', 'fr', native_enum=False), CheckConstraint(),
default='en')
Docs say that when native_enum is set to False, uses VARC
On Nov 9, 2011, at 11:42 AM, Matthew Newville wrote:
> First, I apologize in advance for the vague question and thank you in advance
> for the great SQLAlchemy library, and any help you might be able to give. I
> have a GUI application (wxPython) that uses SQLAlchemy and sqlite3 to store
> s
First, I apologize in advance for the vague question and thank you in
advance for the great SQLAlchemy library, and any help you might be able to
give. I have a GUI application (wxPython) that uses SQLAlchemy and
sqlite3 to store state information. The application connects to network
resourc
this works without any error, comment_after_insert_listener() prints
that target.report.comments_count = 1, but this value isn't commited...
Can't get why prev testcase fails, this works,
but target.report.comments_count value isn't saved :/
def comment_after_insert_listener(mapper, connectio
In testcase above this works too:
session = Session()
user = session.query(User).filter_by(username='sector119').one()
session.close()
session = Session()
report = session.query(Report).get(1)
comment = Comment(content=u'test comment', user=user)
report.comments.append(comment)
session.add(report
Can't get why, but in Pyramid, the same code works, but generate on more
UPDATE statement
report = session.query(TripReport).get(id)
user = session.query(User).filter_by(username='sector119').one()
comment = TripReportComment(content=form.content.data, user=user)
report.comments.append(comment)
s
### TEST 1 STATEMENTS
2011-11-09 13:30:24 EET LOG: statement: BEGIN
2011-11-09 13:30:24 EET LOG: statement: SELECT report.id AS report_id,
report.content AS report_content, report.comments_count AS
report_comments_count, report.user_id AS report_user_id
FROM report
WHERE report
Thanks, Michael, it was my mistake.
I use sqlalchemy with pyramid and comment =
ReportComment(content=form.content.data, user=self.request.user)
where self.request.user is
class RequestFactory(Request):
@reify
def user(self):
db = DBSession()
username = unauthenticated_u
# test_event.py
from sqlalchemy import create_engine
from sqlalchemy.orm import sessionmaker
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy import Column, ForeignKey
from sqlalchemy import Integer, UnicodeText
from sqlalchemy import event
from sqlalchemy.orm import relat