my program code:
engine = create_engine(connect_str, echo=True)Session =
sessionmaker(bind=engine)for bar in default_session.query(BarLog)[:3]:
conf = ManagerConfig(indicator_config='', timeframe=bar.timeframe,
paper_no=1)
default_session.add(conf)
default_session.commit()
log:
Nice to start some discussion and sorry about the unclarity.
Gulli, you are spot on with your code. Thanks!
Next challange is to get all the birthdays of the next 7 days. This code
does *not *do the trick;
members_next = Member.query.filter( \
(extract(MONTH,
On Fri, Aug 30, 2013 at 9:10 AM, Дмитрий Косолапов
kosolapo...@gmail.com wrote:
my program code:
engine = create_engine(connect_str, echo=True)
Session = sessionmaker(bind=engine)
for bar in default_session.query(BarLog)[:3]:
conf = ManagerConfig(indicator_config='',
The reason for the extra selects is that calling commit() marks objects in
the session as expired, so they need to be refreshed. From the ORM
tutorialhttp://docs.sqlalchemy.org/en/rel_0_8/orm/tutorial.html
:
SQLAlchemy by default refreshes data from a previous transaction the first
time it’s
Hi,
I've a model with a DateTime column and I need to select rows where the
time part of this column is between two hours (something like: select
all rows where the date is between 6:00 and 11:00).
I need the date information, rows must be deleted after a couple of days.
I don't know how-to
Hi,
I've a model with a DateTime column and I need to select rows where the time
part of this column is between two hours (something like: select all rows
where the date is between 6:00 and 11:00).
I need the date information, rows must be deleted after a couple of days.
I don't know
Hi Warwick,
On 30/08/2013 14:38, Warwick Prince wrote:
I'm sure there is a better way, but you could always filter using a date/time
and supply the date part as well (i.e. today) so that you are comparing
datetime to datetime. (Something like: select all rows where the datetime is
between
Hi Warwick,
On 30/08/2013 14:38, Warwick Prince wrote:
I'm sure there is a better way, but you could always filter using a
date/time and supply the date part as well (i.e. today) so that you are
comparing datetime to datetime. (Something like: select all rows where the
datetime is
Hi *,
I am trying to cache SQLAlchemy queries in memory for a rich client
application. To invalidate the cache for changes seen in the database, I
am trying to drop in-memory instances that have been changed or deleted.
This requires comparing the identity of the deleted objects with
in-memory
One way to do this is to use a function within your database to convert a
timestamp down to a basic time type, and then do comparison on the converted
value. Here is an example using sqlite as the back end. Sqlite has a time
function that can convert a datetime down to a time for you, so we get at
Wonderfull! Exactly what I was looking for. Thank you Jeff.
I was searching in the sqlalchemy documentation for a time function,
but haven't found one. In fact, you can use any function supported by
the database directly with `func`. So I can use `func.time` and this
will use the TIME
Hi Pierre!
SQLAlchemy doesn't do that, because it depends on the underlying
connection layer but I already had this question and made a solution.
You simply have to use another SQLite library, ASPW, -
https://code.google.com/p/apsw/
There are some material over the web (Stack Exchange)
Hi,
I'm currently running several python applications (each app using
sqlalchemy) accessing (read/write) a single SQLite database stored on disk.
For performance reasons, I would like to store this db file in RAM memory
(ie, in my /dev/shm)
The applications would then access a shared
Hi,
I'm currently running several python applications (each app using
sqlalchemy) accessing (read/write) a single SQLite database stored on disk.
For performance reasons, I would like to store this db file in RAM memory
(ie, in my /dev/shm)
The applications would then access a shared
I recently had exactly the same problem on SQLAlchemy 0.8 where doing
something like somestring + Item.some_column would not result in a ||
but in a + operator which sqlite could not handle. To note here in my
case: The some_column was the id, thus an integer. I'm not sure how
SQLAlchemy
In addition to using `func.*` methods, there's also the `extract` method
that works (in most databases) specifically on datetime objects.
sqlalchemy.sql.expression.extract(*field*,
Well, what Jeff wrote is also true.
I do hot-copy of databases because we have a set of products that have
full automated builds and, to increase performance, I made the build
generate the SQLite database on memory and then dump it to the filesystem.
Cheers,
Richard.
Hi,
I'm currently
that's less of a SqlAlchemy question and more of a general database
question.
there are a handful of approaches on StackOverflow, and the easier approach
can differ across databases.
try searching for birthdate/birthday range and postgresql or mysql .
I'd suggest that you find one there,
Oh, that's what it is. The override of the addition + operator by the
concatenation operator || only happens if the right-hand side type is also
a “concatenable” or NULL, not just the left side:
https://github.com/zzzeek/sqlalchemy/blob/rel_0_8_2/lib/sqlalchemy/types.py#L1017-L1023
and integer
This might be a bug then.
String || Integer ; Integer || String
- PostgreSQL and sqlite both allow for a sting integer to be concat
together into a string. Order does not matter.
Integer || Integer
- PostgreSQL will error if 2 ints are concat together.
- sqlite seems to cast both into a
none that I know of beside actually running it on that target database and see
if it raises any errors.
On Aug 30, 2013, at 1:30 AM, monosij.for...@gmail.com wrote:
Hello -
Not very familiar with sqlalchemy yet ...
Is there a way to check if a script I have generated (not using
(note: please keep answering the emails! this is great, I just happen to have
a little bit of net access here..)
here's how you can turn any expression into any other type for Python-side
operator or data coercion purposes (that is, like a CAST but doesn't render
CAST on the database):
from
Okay so basically what you are saying is that this is intended
behaviour? I've been trying to dig through the source for quite some
time now but finding the point where it is decided is harder than I
thought. Could you explain why String + Int gives the operator add and
not concat_op?
On
On Aug 30, 2013, at 9:25 AM, Torsten Landschoff
torsten.landsch...@dynamore.de wrote:
Hi *,
I am trying to cache SQLAlchemy queries in memory for a rich client
application. To invalidate the cache for changes seen in the database, I am
trying to drop in-memory instances that have been
On Aug 30, 2013, at 6:32 PM, Florian Rüchel florian.ruec...@inexplicity.de
wrote:
Okay so basically what you are saying is that this is intended behaviour?
I've been trying to dig through the source for quite some time now but
finding the point where it is decided is harder than I thought.
Could anyone provide some suggestions on where to look in the SQLA code (or
even an example, or some general thoughts) for how to perform a
`joinedload` as the ORM does it for Core tables (or actually an already
executed query which has unresolved references which I'd like to load in a
26 matches
Mail list logo