Hi all,
We're hitting a weird bug here. I'm doing a standard query with
filters, and this is appended to the end:
resultObj = resultObj.order_by(Member.lastname,
Member.firstname,
Member.middleinitial,
Hi all,
I am trying to use the postgres_returning feature with the latest svn
checkout of SqlAlchemy, Python 2.5.2, and Postgresql 8.3.
I have a declarative_base, which works in the declarative base
context. I get it's table reference this way:
al_table =
Argh! I knew it had to be something simple. Thanks!
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
sqlalchemy group.
To post to this group, send email to sqlalchemy@googlegroups.com
To unsubscribe from this group,
Hi again,
I have this table, which has a composite primary key, and no sequence:
# \d log_members
Table public.log_members
Column | Type | Modifiers
+-+---
memberID | integer | not null
logentryID | integer | not null
Indexes:
log_members_pkey
Excellent, thank you. I won't get to try this until Monday.
Gloria
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
sqlalchemy group.
To post to this group, send email to sqlalchemy@googlegroups.com
To unsubscribe
I've traced it further, and it's an odd problem.
This syntax works fine:
memberProfile = self.session.query(MemberProfile).filter
(MemberProfile.memberID.in_(memberid)).order_by
(MemberProfile.memberID)
memberProfile = memberProfile.filter(MemberProfile.city ==
'Jamaica')
I've traced it further, and it's an odd problem.
This syntax works fine:
memberProfile = self.session.query(MemberProfile).filter
(MemberProfile.memberID.in_(memberid)).order_by
(MemberProfile.memberID)
memberProfile = memberProfile.filter(MemberProfile.city ==
'Jamaica')
Ahh, true. I switch the order of these operations, and always the
second one fails, no matter what. How should I debug this problem?
Thank you,
Gloria
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
sqlalchemy group.
Just a quick update: A forced flush between queries does no good.
Creating a new instance for each query seems to be the only immediate
cure.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
sqlalchemy group.
To post
Understood. In my constructor, I was using a shared global
declarative_base, and a single session instance:
metdata = Base.metadata
engine = create_engine(config.db_conn)
engine.echo = False
Session = sessionmaker(bind=engine)
self.session = Session()
Only the self.session
I will put one together with a small database comprised of three
tables. Give me a couple of days, and I will have it to you.
Thank you,
Gloria
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
sqlalchemy group.
To
Hi All,
I have three classes, all using the same declarative_base() instance,
as follows:
In a config file:
global Base
Base = None
def initBase():
global Base
if not Base:
Base = declarative_base()
return Base
Hi All,
I have three classes, all using the same declarative_base() instance,
as follows:
In a config file:
global Base
Base = None
def initBase():
global Base
if not Base:
Base = declarative_base()
return Base
Wow, awesome, it works, thank you!
~G~
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
sqlalchemy group.
To post to this group, send email to sqlalchemy@googlegroups.com
To unsubscribe from this group, send email to
OK, a new problem on the same model:
I try this in my unit test:
memberProfile = self.session.query(MemberProfile).filter
(MemberProfile.memberID.in_(memberid)).order_by
(MemberProfile.memberID).filter(MemberProfile.city == 'Jamaica').all()
and I get this error:
Traceback (most recent call
Thanks for this response. I do need all of the data available at once.
Specifically, here is what I'm trying to do. I'm following this
example right from the docs:
from sqlalchemy import ForeignKey
from sqlalchemy.orm import relation, backref
class Address(Base):
... __tablename__ =
Excellent, thank you! Getting closer. I now use the same
declarative_base on all instances, and I can now successfully refer to
the relation() classes as actual class names instead of strings.
During this query:
memberProfile = session.query(MemberProfile).filter_by
(memberID=81017).first()
I
Just to make it easier to read, I'm missing a FROM clause:
sqlalchemy.exc.ProgrammingError: (ProgrammingError) missing FROM-
clause entry for table member_profiles at character 5151
I read from the archive that this was a bug in 0.4.
Thanks again,
Gloria
D'OH! (slaps head)
Thanks for pointing this out, it makes perfect sense.
I got it working by getting it from the DB, and merging it into the
current session, then deleting:
def DELETE(self,dmemberid):
x = MemberInfo()
memberProfile = x.GET(memberid=dmemberid,raw=True)
merged_obj =
Hi all, thanks for this really helpful list.
My question now involves trying to figure out the correct way to map
this legacy database to SqlAlchemy objects using the declarative_base
model.
This database has two main tables, members, and member_profiles, where
a memberID is the foreign key
Thanks for taking the time to respond. I still get an error, please
see below.
I show the record, just after a successful insert. I then show the
error on delete.
When I go into the db and manually delete these records, they exist as
expected, and the deletion is successful.
Thank you in
This is a strange problem. I'd appreciate any assistance.
I have a class set up using the declarative_bass model, set up in this
way:
member_profile_table = MemberProfile.__table__
metdata = Base.metadata
engine = create_engine(config.db_conn)
Session = sessionmaker(bind=engine)
on?
does the testfile use same engine/.. setup as below?
On Wednesday 28 January 2009 19:21:54 Gloria W wrote:
This is a strange problem. I'd appreciate any assistance.
I have a class set up using the declarative_bass model, set up in
this way:
member_profile_table = MemberProfile.__table__
Hi All, I have something stuping me right now. I'm using SqlAlchemy .
0.5.2 and Python 2.6. My issue is as follows:
This class works perfectly:
import sys
import pprint
import pdb
from sqlalchemy import *
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import *
This should be called Odd Aggregation Issue. I am almost certain it's
not related to inheritance, which is nested further up in the
MemberProfile and Gender objects (which also work file).
--~--~-~--~~~---~--~~
You received this message because you are subscribed
Got it, thanks for your help.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
sqlalchemy group.
To post to this group, send email to sqlalchemy@googlegroups.com
To unsubscribe from this group, send email to [EMAIL
I thought this was a scope problem, but it seems to be even bigger.
This is the error I get:
OperationalError: (OperationalError) (1067, Invalid default value for
'date_created') u'\nCREATE TABLE fu_op_requests (\n
\tfu_op_requests_id INTEGER NOT NULL AUTO_INCREMENT, \n\tname
VARCHAR(50),
This gives me an error:
sqlalchemy.Column('date_created', mysql.MSTimeStamp,
sqlalchemy.PassiveDefault(text(CURRENT_TIMESTAMP)),
nullable=False))
NameError: global name 'text' is not defined
--~--~-~--~~~---~--~~
You received this message because you are
Hi All,
Looking back in these posts, I tried several older variants of MySQL
datetime column initialization discussed here, and they're not
working.
This works in Postgresql:
sqlalchemy.Column('date_created', sqlalchemy.DateTime,
sqlalchemy.PassiveDefault(sqlalchemy.sql.func.now()),
Hi again,
I am looking for a good example on how to form a temporary table. I
have two unrelated tables with no foreign keys. But I want to
consolidate the data into a temp table and sort on their date field,
to see all records chronologically from both tables.
I could do it by hand in Python,
Hi all,
I am trying to use the session syntax to bind to an existing table,
but I am apparently missing something. I want my session to be bound
to this:
my_table = sqlalchemy.Table('my_table', meta, autoload=True,
autoload_with=engine)
and if I use the same engine here:
session =
31 matches
Mail list logo