As part of an ETL process, I need to generate an SHA1 fingerprint that
uniquely defines a row of data (collisions will have to be handled as
well) for the audit trail. The data in tables consists of short
strings and floating point values.
What's the best way to get an SHA1 fingerprint of a row
On Jun 8, 5:09 am, beewee [EMAIL PROTECTED] wrote:
Hi,
thanks for your answers.
Other improvements would include (as previously stated by Michael)
would be to make sure you have indexed all of the items in your WHERE,
ORDER BY, and ON clauses.
I created this index:
create index
It looks like your sub-select (before the joins) is processing up to
140,015 records, so that will slow things down since the database may
not optimize that sub-selection based upon your outer joins. As a
quick check, try reducing the 140,000 offset to 0 (I know this won't
work for your
some_alg = sess.query(Alg).get(8)
sess.query(Email).filter(~Email.threads.any(Thread.alg==some_alg))
The clause Thread.alg=some alg *should* just generate the clause
thread.algid=8...it shouldn't pull in the alg table at all since
its not needed for many-to-one comparison.
That works
I'm doing a query and would like to order the results in alphabetical
order. However, the column used is mixed case, so the results have
all lower-case strings before the upper-case variables.
In SQL, I would fix this by using the lower() function such as:
TABLE data (
strName TEXT() NOT NULL
# How do I apply the lower(field) function to the strName column?
rows = model.data.query().order_by(strName).all(
query.order_by(func.lower(strName))
Thanks Michael - you're a life saver! Somehow, I seemed to have
missed the entire section on sqlalchemy.sql.func.
For anybody else in the
I am quite surprised at the results. I would have thought
ActiveMapper/TurboEntity would only be marginally slower than plain
SQLAlchemy. And again, I'm surprised that SA is faster than MySQLdb. How
does that work out? I though SA used MySQLdb??? Your use of query cache
and best of three