-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
I'm storing a lot of documents (TREC-9 corpus) in a Doc class/table
created using declarative_base():
class Doc(Base):
__tablename__ = 'doc'
id = Column(Integer, primary_key=True)
I = Column(Integer, index=True) # .I sequential
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
Solved it:
def create_indexes(cls, eng):
indexes = cls.metadata.tables[cls.__tablename__].indexes
for idx in indexes:
idx.create(bind=eng)
IOW: RTFM
Regards,
mk
-BEGIN PGP SIGNATURE-
Version: GnuPG v2.0.20 (MingW32)
Hello,
I have an augmented type that holds data for a movie's timecode, which
has the format 00:00:00:00 (hours:minutes:seconds:frame) and is
serialized as a CHAR:
class Timecode(TypeDecorator):
impl = CHAR
def load_dialect_impl(self, dialect):
return
Hi,
I want to retrieve all the people who are born at today's date. I'm using Flask
with sqlalchemy;
class Member(db.Model):
...
dateofbirth = Column(Date)
...
In my view.py;
from datetime import date, timedelta
today = date.today()
members_today =
What's wrong with Member.dateofbirth==datetime.today() ?
On 28 Aug, 2013 7:47 PM, sjo...@congressus.nl wrote:
Hi,
I want to retrieve all the people who are born at today's date. I'm using
Flask with sqlalchemy;
class Member(db.Model):
...
dateofbirth = Column(Date)
...
In my
On Wednesday, August 28, 2013 12:52:03 PM UTC-4, herzaso wrote:
What's wrong with Member.dateofbirth==datetime.today() ?
datetime.today() is now -- or August 28, 2013 12:52:03 PM UTC-4
The OP wants a sql operation that matches the Month+Day of Member.dateofbirth
to the Month+day of today.
sorry, it looks like the OP did want people born on the current
month/day/year combo.
you should be able to wrap all the comparisons in a date like this :
Member.query.filter( sqlalchemy.func.date(Member.dateofbirth) ==
'2013-08-27' ).all()
Member.query.filter(
To clarify:
- The class-level attribute Member.dateofbirth is not a date/datetime
object. It is a instrumented attribute representing a column in the
database table behind this model. So it does not have any method called
replace.
- Once you get an *instance* of Member, the instance-level
On Aug 28, 2013, at 9:59 AM, Sebastian Elsner sebast...@risefx.com wrote:
Now I would like to be able to do the following:
s.query(Foo).update({some_timecode: Foo.some_timecode.add_hours(5)}) # Adds
5 hours to every Foo's timecode
I have seen this should be possible with a Comparator
I think you were right in the first place. He does want to leave the year
out, hence the replace function ... Note to myself - understand the
question before you answer ...
On Wednesday, August 28, 2013 9:01:14 PM UTC+3, Jonathan Vanasco wrote:
sorry, it looks like the OP did want people born
sorry, it looks like the OP did want people born on the current
month/day/year combo.
No, you were right the first time : ) ... he wanted members whose
dateofbirth, *after changing the year to the current year*, would be today.
That amounts to equating the month and day only.
Something like
Hi,
Before spamming the issue tracker and since I'm new to SQLAlchemy and may
have misunderstood how to use `append_whereclause()`, I thought I seek
confirmation on this mailing list.
The code:
def test_append_whereclause(self):
url = 'localhost'
username = 'donald'
On Aug 28, 2013, at 10:11 PM, gbr doubl...@directbox.com wrote:
Hi,
Before spamming the issue tracker and since I'm new to SQLAlchemy and may
have misunderstood how to use `append_whereclause()`, I thought I seek
confirmation on this mailing list.
The code:
def
this looks a little weird to me, because it seems like you're using parts
of the ORM (namely sessionmaker) and the rest is the Engine.
anyways, you want to address the `table.column`; the results don't exist
yet.
you can print out any query whenever you'd like
below are 2 ways to generate
I'd like to run some tests against my app to make sure I'm properly closing
all of the sessions that I open. Is there a way to get the number of open
database sessions with SQLAlchemy? Is this a strange request that hints I
may be taking the wrong approach?
Currently I'm using scoped sessions
to compile the WHERE clause of query means we look at query.c.id
which means we must render the table query which is how it cycles.
Why does it need to compile the whole query when I just want to use than
column name of the query?
What it seems like you're looking to do is
You're right. These two queries work fine. However, I don't have access to
`location.c.id` which is why I hoped to be able to use attributes of
`query`.
I've copied the example out of a bigger program which mixes Core and ORM
features (hence the use of sessionmaker).
On Thursday, August 29,
17 matches
Mail list logo