Hi,
This might be a noob question, but I am trying to reproduce the
following sql query in SA
select user_id, friend_id from follows where friend_id not (in select
id from users);
First, I do this:
subquery = Session.query(User.id).subquery()
Then
q =
Hi Neil
I managed to make queries on those tables by creating a new table
definition and getting a class mapping from that explicitly, for
example:
from sqlalchemy.ext.sqlsoup import SqlSoup
from sqlalchemy import *
engine = create_engine('sqlite:///:memory:')
metadata =
cant reproduce.
test case:
from sqlalchemy import *
from sqlalchemy.orm import *
from sqlalchemy.ext.declarative import declarative_base
metadata = MetaData()
Base = declarative_base(metadata=metadata)
class User(Base):
__tablename__ = 'users'
id = Column(Integer, primary_key=True)
That's incredibly strange, because I ran your exact code and got this
for output
SELECT follows.friend_id
FROM follows, (SELECT users.id AS id
FROM users) AS anon_1
WHERE follows.friend_id NOT IN SELECT users.id
FROM users
I checked which version of SA I was running and it was 0.5.2
Upgraded
posts_table = sa.Table('posts', metadata,
sa.Column(id,sa.Integer, sa.Sequence
('post_id_seq'), primary_key=True),
sa.Column('userid', sa.types.Integer,
sa.ForeignKey('users.id'), nullable = False),
sa.Column('title',
hello,
i am looking for help and explanation to reflect tables in context of
app server like cherrypy. i can't find a 'place' to auto-load and map
tables. if you do it as part of cp start thread (e.g.
http://cherrypy.org/wiki/CustomPlugins,
http://tools.cherrypy.org/wiki/Databases),
we load/map
Hello,
In my application I have a function that looks more or less like this
def run(self):
# process first object in sequence
for firstObject in firstObjects:
self.session.add(firstObject)
self.session.commit()
# process second object in
Hello,
In my application I have a function that looks more or less like this
def run(self):
# process first object in sequence
for firstObject in firstObjects:
self.session.add(firstObject)
self.session.commit()
# process second object in
squelching typically means one of two things.
either you're doing this:
try:
# do stuff with session
except:
print error !
# .. keep going
or, you are allowing concurrent access to a single session with
multiple threads, one of your threads is throwing an exception
(usually
Hi gang,
I've recently started using sqlalchemy, so hopefully this isn't a stupid
question...
I was wondering whether there was an easy way to obtain a particular table's
schema if one is using just bare connection (ie, not using any special
orm's). Specifically, is there a utility method
10 matches
Mail list logo