My search skills are failing me, and I hope you all can help.
(Apologies that there is some heresy here)
Assumptions:
1) Suppose I have objects made from json (dicts of strings, lists of
dicts, etc.)
2) (for simplicity, assume these nestings don't go very deep)
3) getting this right 90% of
Suppose this is my table:
a_table = Table(
'a_table', metadata,
Column('ts',Integer, index=True, nullable=False),
Column('country',String, index=True, nullable=False),
Column('somestat',Integer,nullable=False),
, Gregg Lind wrote:
Suppose this is my table:
a_table = Table(
'a_table', metadata,
Column('ts',Integer, index=True, nullable=False),
Column('country',String, index=True, nullable=False),
Column('somestat',Integer,nullable=False
suppose:
summary_table = Table(
'summary', metadata,
Column('ts',Integer, index=True, nullable=False),
Column('url',String, index=True, nullable=False),
Column('hits',Integer, nullable=False),
PrimaryKeyConstraint('ts','url','hits',name='summary_pk'),
/index.html' AND
faketable.ts = 1829292929 AND faketable.hits 100
If I had this string repr with filled params, I could just a string
sub / regex,
and go all the way into hackery!
On Aug 4, 10:20 am, Michael Bayer mike...@zzzcomputing.com wrote:
On Aug 4, 2010, at 10:34 AM, Gregg Lind wrote
Thank you for the more detailed explanation! I will do some
experiments with it!
Gregg
On Aug 4, 12:39 pm, Michael Bayer mike...@zzzcomputing.com wrote:
On Aug 4, 2010, at 1:26 PM, Gregg Lind wrote:
Thanks for the advice!
One minor nit. At least in my experience, str(bound query
I'd like to use the postgresql OVER constructions, as seen at
http://www.postgresql.org/docs/8.4/static/tutorial-window.html.
Some of the things I tried:
# gives an extra comma, which is fail.
print select([s.ts,PARTITION OVER( ts )])
SELECT summary.ts, PARTITION OVER( ts )
FROM summary
#
I've been trying to use pg's copy_expert semantics with sessions,
but
something is eluding me.
Observations:
1. It seems like I have to wrap the copy_expert cursor in a
transaction and commit()
in order to make it actually fire (see pgsql_copy below).
2. When I try wrapping it in
can't see the config file directly)
Thanks again for the help!
Gregg
On Jun 17, 8:04 pm, Michael Bayer mike...@zzzcomputing.com wrote:
On Jun 17, 2010, at 8:14 PM, Gregg Lind wrote:
What built-in tools / techniques should I use when trying to
troubleshoot the 'too many clients already' fatal
What built-in tools / techniques should I use when trying to
troubleshoot the 'too many clients already' fatal error.
1. Connecting to PG locally, fwiw,
2. I have full privileges on the db
My connections can come from at least:
- create_engine
I try to be careful to del engine after I'm done
Is there a nice way to get server_version_info from an existing
connection or engine?
Right now it looks quite buried in (for pg):
sqlalchemy.database.postgres.PGDialiect().server_version_info(myconnection).
--
You received this message because you are subscribed to the Google Groups
What I think I'm seeing is that an object can be created even without it's
ForeignKeyConstraint being filled.
To run the test code below:
$ dropdb test18; createdb test18; python testcode.py
This builds on
http://groups.google.com/group/sqlalchemy/browse_thread/thread/eb240f3f2555a5e7/
.
I
Thank you both for the advice. Dern NULLs causing trouble again.
GL
On Tue, Sep 15, 2009 at 4:34 PM, Conor conor.edward.da...@gmail.com wrote:
On Sep 15, 4:08 pm, Michael Bayer mike...@zzzcomputing.com wrote:
Gregg Lind wrote:
What I think I'm seeing is that an object can be created
Based on Michael Bayer's hint, I built this instance-level changeable
object. It used Declarative, which actually makes it a bit tougher, but
this code should work for pypo's also. It's hackish in that it just monkeys
with __setattr__, but it's clear(ish) what's happening.
If you need to use some SQL is that is not supported by UniqueConstraint,
PrimaryKeyConstraint and friends, you can use the DDL statement:
# DDL to only run on postgres, incorporating declarative style
from sqlalchemy.schema import DDL
DDL('''ALTER TABLE orgdata ADD
I have a many-to-one relation, let's say between Address and User, both
created using Declarative.
I would like it that if an Address references a User, it will create that
User, if it doesn't exist. Otherwise, it should use the existing one.
There should be no addresses in the table that don't
Bayer mike...@zzzcomputing.comwrote:
Gregg Lind wrote:
I have a many-to-one relation, let's say between Address and User, both
created using Declarative.
I would like it that if an Address references a User, it will create that
User, if it doesn't exist. Otherwise, it should use
parts, other than the hop id.
On Thu, Jul 23, 2009 at 8:13 PM, Michael Bayermike...@zzzcomputing.com wrote:
On Jul 23, 2009, at 8:43 PM, Gregg Lind wrote:
Hm. I appreciate the help, but something is clearly still failing
here.
session.query(Route,*sq.c).join(sq.c.max_hop)
ArgumentError
, and for making SqlA such a great (and
powerful!) product.
Thanks!
GL
On Fri, Jul 24, 2009 at 11:59 AM, Michael Bayermike...@zzzcomputing.com wrote:
Gregg Lind wrote:
session.query(Route.ts,Route.startpoint,Route.target,func.max(Route.hop_id).label('max_hop'))\
.group_by(Route.ts
I have read over
http://www.sqlalchemy.org/docs/05/ormtutorial.html#using-subqueries
and http://www.mail-archive.com/sqlalchemy@googlegroups.com/msg11439.html,
but I'm having trouble putting the pieces together.
In the demo() below, I want to find the row in the database with the
max for every
On Thu, Jul 23, 2009 at 3:24 PM, Michael Bayermike...@zzzcomputing.com wrote:
im assuming you're using MySQL since the GROUP BY below doesn't
accommodate every column in the subquery (would be rejected by most DBs).
Corrected. It was Sqlite, but good catch.
youll want to query each column
, Michael Bayermike...@zzzcomputing.com wrote:
On Jul 23, 2009, at 5:20 PM, Gregg Lind wrote:
How do I implement this join? If I do this:
sq =
session
.query
(Route
.ts
,Route
.startpoint,Route.target,func.max(Route.hop_id).label('max_hop'))
sq = sq.group_by(Route.ts,Route.startpoint
'''
Based on the thread titled filter relation based on column value
at
http://groups.google.com/group/sqlalchemy/browse_thread/thread/0db7423d986ba543
and some others, I'm curious about how to better get my SqlA code
working
with historical (better term?) databases, where the relational state
of magic as you suggest!
Thanks for the advice!
Gregg
On Thu, Jul 16, 2009 at 10:17 AM, Michael Bayermike...@zzzcomputing.com wrote:
Gregg Lind wrote:
Questions:
1. Is there a SQLAlchemical way to write group_snapshot_ts into
a declarative class, such that the joins and loader respect
Jess,
Thanks for posting the actual class :) Just reading the description
use contains_eager didn't tell me enough about how to make it
happen.
Cheers,
Gregg
On Thu, Jul 16, 2009 at 12:54 PM, jessjesslp...@gmail.com wrote:
I believe that I asked Michael a similar question, in a different
and make this answer easier to find?
Gregg
On Fri, May 29, 2009 at 12:10 PM, Michael Bayer
mike...@zzzcomputing.com wrote:
Gregg Lind wrote:
I use declarative base for defining classes.
I have a constraint that only works in Postgres. How do I declare
that constraint lowername_check only
)
return buf.getvalue()
On Fri, May 29, 2009 at 12:27 PM, Gregg Lind gregg.l...@gmail.com wrote:
As always, thank you for the complete, exhaustive answer. This
particular thing is definitely and edge case, and rather non-obvious,
so thank you for walking me through it.
Either of those
I believe by map function, Timothy may be implying that you should
use any of the python idioms for converting iterables of tuples to a
straight tuple. The one I like best
from itertools import chain
q = session.query(User.name) #(User is a class)
names = itertools.chain(*q.all() )
But you
Good morning!
I hope I'm not tipping any sacred cows here, but for simple SqlA
objects, it seems to be a heckuva lot faster to just insert into the
table directly (using SqlA expression language) than to insert the
objects via session.flush(). In the attached tests, I'm observing a
10x -20x
Some followups:
Python 2.4.3 on 64-bit linux.
Timings are near identical in SA 0.5.2 and 0.5.3.
On Apr 8, 9:57 am, Gregg Lind gregg.l...@gmail.com wrote:
Good morning!
I hope I'm not tipping any sacred cows here, but for simple SqlA
objects, it seems to be a heckuva lot faster to just
...@zzzcomputing.com wrote:
Gregg Lind wrote:
Good morning!
I hope I'm not tipping any sacred cows here, but for simple SqlA
objects, it seems to be a heckuva lot faster to just insert into the
table directly (using SqlA expression language) than to insert the
objects via session.flush
I believe you want session.expunge() or session.expunge_all().
GL
On Wed, Apr 8, 2009 at 6:05 PM, Chris Lewis cfle...@gmail.com wrote:
Hi everyone!
I have a threaded application which deals with a lot of records (it
generates hundreds of thousands in an hour). I have a Database module
How does one create a TypeDecorator to export and import JSON to a
database using SA?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
sqlalchemy group.
To post to this group, send email to
Thank you, that's simpler than my attempts, for sure!
On Wed, Feb 25, 2009 at 10:27 AM, Roger Demetrescu
roger.demetre...@gmail.com wrote:
On Wed, Feb 25, 2009 at 11:39, Gregg Lind gregg.l...@gmail.com wrote:
How does one create a TypeDecorator to export and import JSON to a
database
nightmarish.
I don't have any insights on the SA front, alas.
Gregg Lind
On Tue, Feb 24, 2009 at 2:41 PM, paniq303 paniq...@googlemail.com wrote:
On Feb 24, 5:16 pm, a...@svilendobrev.com wrote:
these are two general patterns, observer/listener and undo/redo
(command-pattern), which have nothing
35 matches
Mail list logo