Re: [sqlalchemy] persisted enum value from PEP-435 enum

2017-12-27 Thread Jon Snyder
quot;validate_strings", impl.validate_strings) > +kw.setdefault("values_callable", impl.values_callable) > return cls(**kw) > > def _setup_for_values(self, values, objects, kw): > > On Tue, Dec 26, 2017 at 8:07 PM, Jon Snyder <snyder@gmail.c

Re: [sqlalchemy] persisted enum value from PEP-435 enum

2017-12-26 Thread Jon Snyder
a breakpoint into Enum._enum_init, I see the correct values being populated from my function. But I'm clearly missing a step here. Jon On Tue, Dec 26, 2017 at 1:38 PM, Mike Bayer <mike...@zzzcomputing.com> wrote: > On Tue, Dec 26, 2017 at 12:49 PM, Jon Snyder <snyder@gmail.com&

Re: [sqlalchemy] persisted enum value from PEP-435 enum

2017-12-26 Thread Jon Snyder
4, 2017 at 1:56 PM, Mike Bayer <mike...@zzzcomputing.com> wrote: > On Mon, Dec 4, 2017 at 12:35 PM, Jon Snyder <snyder@gmail.com> wrote: > > Hi, > > > > The documentation and code is quite clear that it's the name, not the > value, > > of

[sqlalchemy] persisted enum value from PEP-435 enum

2017-12-04 Thread Jon Snyder
Hi, The documentation and code is quite clear that it's the name, not the value, of a PEP-435 compliant enum that is persisted to the database. My use case is that existing enums already in the db are using strings that are not

Re: [sqlalchemy] Writing code that works both before and after a migration

2016-07-06 Thread Jon Davidson
On Wed, Jul 6, 2016, at 12:25 PM, Mike Bayer wrote: > so yeah this use case is a big deal now, because all of openstack wants > to do it. > > However in openstack, they at least know what version the target schema > is at, so while they need to run code that talks to the "old" and "new" >

[sqlalchemy] Writing code that works both before and after a migration

2016-07-05 Thread Jon Davidson
In my current employer's setup, we use SQLAlchemy core and ORM, but we use a homegrown migration system instead of alembic. When possible, we want to write code so that it can work equally well with the old DB schema and the new DB schema. In this case, I am adding a column, and if the column

Re: [sqlalchemy] Searching from jsonb list

2016-01-05 Thread Jon Rosebaugh
"public.jtable" > Column | Type | Modifiers | Storage | Stats target | Description > +---+---+--+--+- > data | jsonb | | extended | | > > > > maanantai 4. tammikuuta 2016 19.41.29 UTC+2 Jo

Re: [sqlalchemy] Searching from jsonb list

2016-01-04 Thread Jon Rosebaugh
ta @> > %(data_1)s'] [parameters: {'data_1': 'third'}] > > > torstai 31. joulukuuta 2015 16.11.47 UTC+2 Jon Rosebaugh kirjoitti: > > > > Your SQL itself isn't going to work; there's no 'item' column in your > > select statement. You should read > > http://www.p

Re: [sqlalchemy] Searching from jsonb list

2015-12-31 Thread Jon Rosebaugh
Your SQL itself isn't going to work; there's no 'item' column in your select statement. You should read http://www.postgresql.org/docs/9.4/interactive/functions-json.html to see what operators you have. (I think you want '@>', not LIKE.) In SQLAlchemy, this would be done as

Re: [sqlalchemy] Defining a unique constraint on an attribute of a Postgres JSON field

2015-12-30 Thread Jon Rosebaugh
I think you might want to use the lightweight sqlalchemy.column() (lowercase!) expression; UniqueConstraint(sa.column('data', JSON)['email']) might work. On 12/30/15 5:58 PM, Andrew Muro wrote: (SQLAlchemy 1.0.11) I'm trying to figure out how to define a unique constraint from within the

Re: Select a subset of declarative classes to migrate

2015-11-18 Thread Jon Rosebaugh
Sure, but declarative classes have a table. MyModel.__table__.info['exclude_from_autogen']=True (you'll probably want to write a class decorator that sets this, actually.) On Wed, Nov 18, 2015, at 02:59 AM, Michal Petrucha wrote: > On Tue, Nov 17, 2015 at 11:26:41AM -0500, Jon Rosebaugh wr

Re: Production and Development environments

2015-11-17 Thread Jon Rosebaugh
I would definitely agree using postgres in both dev and prod is the way to go here; sqlite behaves sufficiently differently, particularly around DDL. At Axial we previously had multiple databases in concurrent use, with migrations operating on both databases at once. We modified env.py's

Re: Select a subset of declarative classes to migrate

2015-11-17 Thread Jon Rosebaugh
You can configure an include_object() function which can inspect the model and decide whether or not to include the model in autogenerated migrations: http://alembic.readthedocs.org/en/latest/api/runtime.html#alembic.runtime.environment.EnvironmentContext.configure.params.include_object Then you

Re: [sqlalchemy] emulating psql's "\copy" function?

2015-10-13 Thread Jon Nelson
On Tue, Oct 13, 2015 at 2:49 PM, Jon Nelson <jnel...@jamponi.net> wrote: > On Tue, Oct 13, 2015 at 1:55 PM, Jonathan Vanasco <jonat...@findmeon.com> > wrote: >> As part of an archiving routine that uses SqlAlchemy, I need to execute some >> pretty specific com

Re: [sqlalchemy] emulating psql's "\copy" function?

2015-10-13 Thread Jon Nelson
a suggestion for a workaround? I should be able to provide you with something, as I use this functionality quite often. However, I must step away from my desk for the moment and thus there will be a delay. -- Jon -- You received this message because you are subscribed to the Google Gro

[sqlalchemy] Difficulty pre-populating session without using .get

2015-01-09 Thread Jon Nelson
I'm having a bit of trouble. Let's say I have N primary key IDs for a set of objects. I want to load all of those objects into the session, but I'd like that to happen all in one query. dbsess.query(object_type).filter(object_type.primary_key.in_(some_list_of_ids)).all() # then I made (one or

Re: [sqlalchemy] Difficulty pre-populating session without using .get

2015-01-09 Thread Jon Nelson
On Fri, Jan 9, 2015 at 1:19 PM, Michael Bayer mike...@zzzcomputing.com wrote: Jon Nelson jnel...@jamponi.net wrote: I'm having a bit of trouble. Let's say I have N primary key IDs for a set of objects. I want to load all of those objects into the session, but I'd like that to happen all

Re: [sqlalchemy] Difficulty pre-populating session without using .get

2015-01-09 Thread Jon Nelson
On Fri, Jan 9, 2015 at 2:21 PM, Michael Bayer mike...@zzzcomputing.com wrote: Jon Nelson jnel...@jamponi.net wrote: so you could use either merge() or merge_result() but to avoid any SQL set load=False. When I tried with load=False, I got an error. I am using 0.9.8. care to be more

Re: [sqlalchemy] Difficulty pre-populating session without using .get

2015-01-09 Thread Jon Nelson
On Fri, Jan 9, 2015 at 2:42 PM, Jon Nelson jnel...@jamponi.net wrote: On Fri, Jan 9, 2015 at 2:21 PM, Michael Bayer mike...@zzzcomputing.com wrote: Jon Nelson jnel...@jamponi.net wrote: so you could use either merge() or merge_result() but to avoid any SQL set load=False. When I tried

[sqlalchemy] mysql vs. postgresql introspection and unique indices

2014-11-14 Thread Jon Nelson
support for additionally annotating indexes with 'duplicates_constraint', but there is no similar support for MySQL. Will 'duplicates_constraint' support be added to MySQL as well? Will that appear in 0.9.9? -- Jon Software Blacksmith -- You received this message because you are subscribed

[sqlalchemy] a problem recently encountered with the example 'Explain'

2014-11-10 Thread Jon Nelson
with RETURNING (despite the inline=True). What's going on here? -- Jon Software Blacksmith -- You received this message because you are subscribed to the Google Groups sqlalchemy group. To unsubscribe from this group and stop receiving emails from it, send an email to sqlalchemy+unsubscr

Re: [sqlalchemy] a problem recently encountered with the example 'Explain'

2014-11-10 Thread Jon Nelson
Now the statement doesn't render with RETURNING, however I still get this: AttributeError: 'Explain' object has no attribute '_returning' -- You received this message because you are subscribed to the Google Groups sqlalchemy group. To unsubscribe from this group and stop receiving emails from

[sqlalchemy] Not identifying all unique constraints in sqlite

2014-10-28 Thread Jon Nelson
In sqlite you can define a unique constraint without a name (and without CONSTRAINT): CREATE TABLE foo (a int, b int, UNIQUE (a,b)); The SQLAlchemy get_unique_constraints doesn't pick that up, due to the regex looking for CONSTRAINT some name UNIQUE (columns here). What's a reasonable

Re: [sqlalchemy] Working with PostgreSQL functions that operate on selectables

2014-10-03 Thread Jon Rosebaugh
it, func.row_to_json(literal_column(’s’)). On Oct 2, 2014, at 11:54 PM, Jon Rosebaugh cha...@gmail.com javascript: wrote: I'm having some trouble with the Postgresql function row_to_json. It's possible to use it on an entire table to turn each row from the table into a JSON object, like

[sqlalchemy] Working with PostgreSQL functions that operate on selectables

2014-10-02 Thread Jon Rosebaugh
I'm having some trouble with the Postgresql function row_to_json. It's possible to use it on an entire table to turn each row from the table into a JSON object, like select row_to_json(t) as j from some_table as t. You can also use a subselect, and that's where the trouble lies. I want to

[sqlalchemy] table.update() and CTE

2014-07-25 Thread Jon Nelson
references (and defines) the CTE, but not an update. -- Jon Software Blacksmith -- You received this message because you are subscribed to the Google Groups sqlalchemy group. To unsubscribe from this group and stop receiving emails from it, send an email to sqlalchemy+unsubscr...@googlegroups.com

Would be nice if Alembic exposed friendly Python interfaces

2014-06-10 Thread Jon Rosebaugh
At my workplace, we use Alembic to handle migrations, but we frequently have minor issues like forgetting to downgrade to the most recent common migration before switching git branches, or not noticing that a branch has migrations to be run when checking it out. This causes a bit of aggravation.

[sqlalchemy] history and postgresql arrays

2014-05-27 Thread Jon Nelson
'].history History(added=(), unchanged=[[20,30,40]], deleted=()) But if I change o.nums directly: o.nums = [ 40,50,60 ] d['nums'].history History(added=[[40,50,60]], unchanged=(), deleted=[[20,30,40]]) and that seems weird. -- Jon Software Blacksmith -- You received this message because you

[sqlalchemy] logging question

2013-11-19 Thread Jon Nelson
. What's likely to be going on here? -- Jon Software Blacksmith -- You received this message because you are subscribed to the Google Groups sqlalchemy group. To unsubscribe from this group and stop receiving emails from it, send an email to sqlalchemy+unsubscr...@googlegroups.com. To post

Re: [sqlalchemy] logging question

2013-11-19 Thread Jon Nelson
by a library type of thing, but (ultimately) 100% my fault. Sorry to have bothered! -- Jon Software Blacksmith -- You received this message because you are subscribed to the Google Groups sqlalchemy group. To unsubscribe from this group and stop receiving emails from it, send an email

Re: [sqlalchemy] Using PostgreSQL DELETE ... USING tableA... syntax

2013-11-16 Thread Jon Nelson
That's pretty spectacular! Will something like that make it into a future release of SQLAlchemy? -- Jon -- You received this message because you are subscribed to the Google Groups sqlalchemy group. To unsubscribe from this group and stop receiving emails from it, send an email to sqlalchemy

[sqlalchemy] declarative, reflection, and secondary tables.

2013-11-16 Thread Jon Nelson
-update,merge,refresh-expire,expunge, secondary='table_one_secondary_table', passive_deletes=True ) -- Jon Software Blacksmith -- You received this message because you are subscribed to the Google Groups sqlalchemy group. To unsubscribe from this group and stop receiving emails from

[sqlalchemy] Using PostgreSQL DELETE ... USING tableA... syntax

2013-11-15 Thread Jon Nelson
) q.delete().with_hint('USING', [t2])) DELETE FROM t1 USING t2 WHERE t1.some_column == t2.some_other_column ; What if there are multiple Tables (or selectables) in to render? -- Jon Software Blacksmith -- You received this message because you are subscribed to the Google Groups sqlalchemy group

[sqlalchemy] Postgres composite types and sqlalchemy; Having trouble with events system; Advice requested

2013-11-03 Thread Jon Rosebaugh
I'm trying to implement support for Postgres's composite types, which essentially let you make a type which is a struct of other types. This involves several kinds of functionality: * Psycopg2 maps composite types as namedtuples. However, the register_composite() function has to be called for

[sqlalchemy] changing the column order of a select

2013-07-24 Thread Jon Nelson
Let's say I've built up a select statement but only after it's built do I know the order of the columns that I'd ultimately prefer. What's the best way to change the column order of a select? -- Jon Software Blacksmith -- You received this message because you are subscribed to the Google

[sqlalchemy] 0.8 doc url goes to 0.9 docs

2013-06-02 Thread Jon Rosebaugh
The url I've been using for the 0.8 docs (http://docs.sqlalchemy.org/en/rel_0_8/) now goes to a page listing 0.9 docs. There doesn't seem to be any way to get at 0.8's docs from the website. -- You received this message because you are subscribed to the Google Groups sqlalchemy group. To

Re: [sqlalchemy] 0.8 doc url goes to 0.9 docs

2013-06-02 Thread Jon Rosebaugh
checking out master. I'm not sure how to fix this at the moment. On Jun 2, 2013, at 8:34 PM, Jon Rosebaugh cha...@gmail.com javascript: wrote: The url I've been using for the 0.8 docs ( http://docs.sqlalchemy.org/en/rel_0_8/) now goes to a page listing 0.9 docs. There doesn't seem

[sqlalchemy] trouble with postgresql ANY

2013-05-28 Thread Jon Nelson
is an Integer(). -- Jon Software Blacksmith -- You received this message because you are subscribed to the Google Groups sqlalchemy group. To unsubscribe from this group and stop receiving emails from it, send an email to sqlalchemy+unsubscr...@googlegroups.com. To post to this group, send

[sqlalchemy] How to map a oracle table with long table name

2013-04-16 Thread Evan Jon
Hello all, I want to map a table whose name is BAND_ORDER_OF_LOCAL_TESTING. class BandOrderOfLocalTesting(Base): __TABLENAME__ = 'BAND_ORDER_OF_LOCAL_TESTING' order_id = Column(order_id, Number(18), primary_key=True) ... Each time I got the following message: 013-04-17 09:26:55,857

[sqlalchemy] Re: Set-based association proxy through AppenderQuery?

2012-07-17 Thread Jon Parise
I have a similar use case, and aside from introducing a duplicate non-lazy relationship to back the association_proxy, I haven't found a solution. Does anyone have a more elegant approach? On Saturday, February 11, 2012 12:15:38 PM UTC-8, Mark Friedenbach wrote: Hi, Is it possible to have

Re: [sqlalchemy] Dialect-specific UserDefinedType variants

2012-07-09 Thread Jon Parise
this in using the load_dialect_impl() method. That's the end effect of with_variant() in any case (it creates a new TypeDecorator). On Jul 9, 2012, at 12:38 AM, Jon Parise wrote: I have a simple HStore(UserDefinedType) implementation that works well with PostgreSQL. I'd also like to provide

[sqlalchemy] Dialect-specific UserDefinedType variants

2012-07-08 Thread Jon Parise
I have a simple HStore(UserDefinedType) implementation that works well with PostgreSQL. I'd also like to provide a more generic HStore implementation that can be used with SQLite for in-memory unit testing databases. That fallback implementation could be implemented in terms of pickled or

[sqlalchemy] Bidirectional, self-referential association table

2012-03-14 Thread Jon Parise
I'm considering modeling many-to-many friend relationships between users using an association table. The tricky aspect is that I'd like the association table's entries to be bidirectional, meaning the single entry (A,B) represents friendship in both directions. The standard way to model this

Re: [sqlalchemy] performance vs. psycopg2

2011-12-16 Thread Jon Nelson
On Fri, Dec 16, 2011 at 3:30 AM, Gaëtan de Menten gdemen...@gmail.com wrote: On Thu, Dec 15, 2011 at 19:52, Jon Nelson jnel...@jamponi.net wrote: On Thu, Dec 15, 2011 at 12:01 PM, Michael Bayer mike...@zzzcomputing.com wrote: On Dec 15, 2011, at 12:51 PM, Jon Nelson wrote: Up front, I'm

Re: [sqlalchemy] SQLA without the ORM?

2011-12-16 Thread Jon Nelson
= sa.orm.sessionmaker() sess = session_factory() sess.begin() try: .. do stuff with sess except: sess.rollback() grump loudly raise else: sess.commit() # if appropriate, sometimes rollback sess.close() # probably unnecessary -- Strange things are afoot at the Circle K. Jon -- You

[sqlalchemy] performance vs. psycopg2

2011-12-15 Thread Jon Nelson
(except RowProxy, maybe). Thoughts? PS - is the OrderedDict implementation in 2.6+ faster or slower than the one SA ships with? -- Strange things are afoot at the Circle K. Jon -- You received this message because you are subscribed to the Google Groups sqlalchemy group. To post to this group, send

Re: [sqlalchemy] performance vs. psycopg2

2011-12-15 Thread Jon Nelson
On Thu, Dec 15, 2011 at 12:01 PM, Michael Bayer mike...@zzzcomputing.com wrote: On Dec 15, 2011, at 12:51 PM, Jon Nelson wrote: Up front, I'm not using the ORM at all, and I'm using SQLAlchemy 0.7.4 with psycopg2 2.4.3 on PostgreSQL 8.4.10 on Linux x86_64. I did some performance testing

[sqlalchemy] IS DISTINCT FROM

2011-10-14 Thread Jon Nelson
(and IS NOT DISTINCT FROM) are supported in firebird and postgresql, and possibly others. -- Jon -- You received this message because you are subscribed to the Google Groups sqlalchemy group. To post to this group, send email to sqlalchemy@googlegroups.com. To unsubscribe from this group, send email

[sqlalchemy] Re: IS DISTINCT FROM

2011-10-14 Thread Jon Nelson
On Fri, Oct 14, 2011 at 4:45 PM, Jon Nelson jnel...@jamponi.net wrote: What is the SA equivalent of: UPDATE foo SET bar=some_function(baz) WHERE bar IS DISTINCT FROM some_function(baz) I get this far (assuming 't' is a Table instance): t.update().values(t.c.bar=sa.func.some_function

Re: [sqlalchemy] Re: IS DISTINCT FROM

2011-10-14 Thread Jon Nelson
On Fri, Oct 14, 2011 at 8:12 PM, Michael Bayer mike...@zzzcomputing.com wrote: for now yes, I've not heard of IS DISTINCT FROM before. In the right places, it's mighty useful. -- Jon -- You received this message because you are subscribed to the Google Groups sqlalchemy group. To post

Re: [sqlalchemy] Re: Postgresql and reflection: system tables VS information_schema

2011-10-05 Thread Jon Nelson
of postgresql is a win (for everybody). -- Jon -- You received this message because you are subscribed to the Google Groups sqlalchemy group. To post to this group, send email to sqlalchemy@googlegroups.com. To unsubscribe from this group, send email to sqlalchemy+unsubscr...@googlegroups.com

[sqlalchemy] problem with with_only_columns

2011-07-01 Thread Jon Nelson
= sa.MetaData() m.bind = conn t = sa.Table('a', m, sa.Column('a', sa.String()) ) t.create() s1 = sa.select( [t.c.a, sa.func.length(t.c.a), t.c.a * 2 ] ) cols = [ c for c in s1.c ] s2 = s1.with_only_columns( cols ) print s1 print s2 conn.execute(s1) conn.execute(s2) -- Jon -- You received this message

[sqlalchemy] begin_nested failures starting with 0.7

2011-06-01 Thread Jon Nelson
' not in meta.tables: t = sa.Table('bar', meta, sa.Column('a', sa.TEXT(), nullable=False), ) t.create(bind=conn) if 'bar' in meta.tables: t = meta.tables['bar'] t.drop() meta.remove(t) del t sess.commit() if __name__ == '__main__': main() -- Jon -- You

Re: [sqlalchemy] begin_nested failures starting with 0.7

2011-06-01 Thread Jon Nelson
did this work in 0.6.[1,2,3,4,5,6,7] ? What's the right way to do this? -- Jon -- You received this message because you are subscribed to the Google Groups sqlalchemy group. To post to this group, send email to sqlalchemy@googlegroups.com. To unsubscribe from this group, send email

Re: [sqlalchemy] begin_nested failures starting with 0.7

2011-06-01 Thread Jon Nelson
On Wed, Jun 1, 2011 at 6:00 PM, Jon Nelson jnel...@jamponi.net wrote: On Wed, Jun 1, 2011 at 4:47 PM, Michael Bayer mike...@zzzcomputing.com wrote: metadata.reflect() would close() the connection used for reflection as it assumed it was passed an Engine, not a Connection, fixed

[sqlalchemy] Fwd: [BUGS] database introspection error

2011-04-21 Thread Jon Nelson
introspection error To: Jon Nelson jnelson+pg...@jamponi.net Cc: pgsql-b...@postgresql.org Jon Nelson jnelson+pg...@jamponi.net writes: SQLAlchemy encountered an error introspecting the tables. After inspecting the SQL that it was running, I boiled it down to this: SELECT c.relname,  a.attname

[sqlalchemy] bug: distinct ON using subquery with un-named alias fails.

2011-04-21 Thread Jon Nelson
be separate and accessible by the test user -- Jon -- You received this message because you are subscribed to the Google Groups sqlalchemy group. To post to this group, send email to sqlalchemy@googlegroups.com. To unsubscribe from this group, send email to sqlalchemy+unsubscr...@googlegroups.com

[sqlalchemy] LIKE operator and double percent signs

2011-02-25 Thread Jon Nelson
was necessary. Why is sqlalchemy emitting two? -- Jon -- You received this message because you are subscribed to the Google Groups sqlalchemy group. To post to this group, send email to sqlalchemy@googlegroups.com. To unsubscribe from this group, send email to sqlalchemy+unsubscr...@googlegroups.com

Re: [sqlalchemy] LIKE operator and double percent signs

2011-02-25 Thread Jon Nelson
as atoms (individual arguments rather than a single, concatenated string) then '%%' is unnecessary. On Feb 25, 2011, at 8:53 AM, Jon Nelson wrote: I've been wondering something about sqlalchemy - let's say I have a text column foo. Being able to do foo.startswith(some_value), foo.endswith

[sqlalchemy] documentation weirdness

2011-02-24 Thread Jon Nelson
Looking at the docs for http://www.sqlalchemy.org/docs/core/expression_api.html#sqlalchemy.sql.expression.Select.locate_all_froms the documentation renders 'locate_all_froms(self)' as though it were not a callable but an attribute. What's up with that? -- Jon -- You received this message

Re: [sqlalchemy] execute at beginning of every session

2011-02-16 Thread Jon Nelson
anything that takes a 'bind' argument) I have to use session.connection(). -- Jon -- You received this message because you are subscribed to the Google Groups sqlalchemy group. To post to this group, send email to sqlalchemy@googlegroups.com. To unsubscribe from this group, send email

Re: [sqlalchemy] execute at beginning of every session

2011-02-16 Thread Jon Nelson
coerces plain textual statements to sqlalchemy.sql.expression.text() so that a single string format may be passed. Aha! Very nice. What about using instances of Session where 'bind' arguments are required? -- Jon -- You received this message because you are subscribed to the Google Groups

Re: [sqlalchemy] execute at beginning of every session

2011-02-16 Thread Jon Nelson
On Wed, Feb 16, 2011 at 12:15 PM, Michael Bayer mike...@zzzcomputing.com wrote: On Feb 16, 2011, at 12:54 PM, Jon Nelson wrote: On Wed, Feb 16, 2011 at 10:51 AM, Michael Bayer mike...@zzzcomputing.com wrote: On Feb 16, 2011, at 10:22 AM, Landreville wrote: Hi, I am trying to set

Re: [sqlalchemy] SQLAlchemy 0.7 beta 1 released

2011-02-13 Thread Jon Nelson
On Sat, Feb 12, 2011 at 8:11 PM, Michael Bayer mike...@zzzcomputing.comwrote: On Feb 12, 2011, at 8:29 PM, Jon Nelson wrote: On Sat, Feb 12, 2011 at 6:51 PM, Michael Bayer mike...@zzzcomputing.comwrote: Hey list - The first beta release of SQLAlchemy 0.7 is available for download

Re: [sqlalchemy] SQLAlchemy 0.7 beta 1 released

2011-02-12 Thread Jon Nelson
://www.sqlalchemy.org/trac/wiki/UsageRecipes/PGValues doesn't do argument quoting and thus appears to suffer from SQL injection possibilities. A safer and built-in mechanism for VALUES might be pretty useful. -- Jon -- You received this message because you are subscribed to the Google Groups sqlalchemy

[sqlalchemy] Sessions and Transactions - What am I doing wrong?

2011-02-06 Thread Jon Nelson
= sa.MetaData() meta.reflect(bind=engine) sess = factory() # if autocommit is False, this fails: sess.begin() -- Jon -- You received this message because you are subscribed to the Google Groups sqlalchemy group. To post to this group, send email to sqlalchemy@googlegroups.com. To unsubscribe from

[sqlalchemy] logging bug in 0.6.6?

2011-01-27 Thread Jon Nelson
that was checked out and returned to the pool. BUG? -- Jon -- You received this message because you are subscribed to the Google Groups sqlalchemy group. To post to this group, send email to sqlalchemy@googlegroups.com. To unsubscribe from this group, send email to sqlalchemy+unsubscr...@googlegroups.com

Re: [sqlalchemy] can't build c extensions for 0.6.6 on CentOS 5.5

2011-01-13 Thread Jon Nelson
On Thu, Jan 13, 2011 at 9:12 AM, Michael Bayer mike...@zzzcomputing.com wrote: assuming this is also your ticket #2023 ? http://www.sqlalchemy.org/trac/ticket/2023 That is not my ticket, but surely appears to be related! -- Jon -- You received this message because you are subscribed

[sqlalchemy] can't build c extensions for 0.6.6 on CentOS 5.5

2011-01-12 Thread Jon Nelson
/sqlalchemy/cextension/resultproxy.c:515: error: expected '}' before 'BaseRowProxy_getitem' -- Jon -- You received this message because you are subscribed to the Google Groups sqlalchemy group. To post to this group, send email to sqlalch...@googlegroups.com. To unsubscribe from this group, send

[sqlalchemy] MetaData, postgresql, and temporary tables

2010-11-22 Thread Jon Nelson
table namespace with: select nspname from pg_namespace n where n.oid = pg_my_temp_schema(); c. reflect with schema=nspname from above 3. When I'm done, I always issue a ROLLBACK. What can I do to make sure the MetaData forgets about this temporary table? -- Jon -- You received this message

Re: [sqlalchemy] (Hopefully) simple problem with backrefs not being loaded when eagerloading.

2010-09-14 Thread Jon Siddle
On 13/09/10 18:21, Michael Bayer wrote: On Sep 13, 2010, at 12:26 PM, Jon Siddle wrote: This relationship is satisfied as you request it, and it works by looking in the current Session's identity map for the primary key stored by the many-to-one. The operation falls under the realm

Re: [sqlalchemy] Re: (Hopefully) simple problem with backrefs not being loaded when eagerloading.

2010-09-14 Thread Jon Siddle
the value to the most people. Perhaps just a note in the eagerload docs to say ...will not load backreferences eagerly. If you are using detached objects, try the join...contains_eager pattern. or words to that effect? Thanks Jon On 14/09/10 16:27, Michael Bayer wrote: On Sep 14, 6:03 am, Jon

[sqlalchemy] (Hopefully) simple problem with backrefs not being loaded when eagerloading.

2010-09-13 Thread Jon Siddle
session (no SQL is sent to the DB for c.parent) These apprent do-nothing loops are starting to clutter the code. There must be a better way. Thanks Jon -- Jon Siddle, CoreFiling Limited Software Tools Developer http://www.corefiling.com Phone: +44-1865-203192 -- You received this message

Re: [sqlalchemy] (Hopefully) simple problem with backrefs not being loaded when eagerloading.

2010-09-13 Thread Jon Siddle
On 13/09/10 16:45, Michael Bayer wrote: On Sep 13, 2010, at 8:48 AM, Jon Siddle wrote: I'm sure I'm missing something simple here, and any pointers in the right direction would be greatly appreciated. Take for instance the following code: session = Session() parents = session.query(Parent

Re: [sqlalchemy] Re: Postgresql Partition / INHERIT and table names....

2010-09-13 Thread Jon Nelson
instantiate Partition twice: p = Partition(t1, 'myt1') q = select(p) q.append_column(p.c.data) -- Jon -- You received this message because you are subscribed to the Google Groups sqlalchemy group. To post to this group, send email to sqlalch...@googlegroups.com. To unsubscribe from this group, send

Re: [sqlalchemy] isolation_level and psycopg2?

2010-08-10 Thread Jon Nelson
Confirmed - your patch works great: [pid 12905] sendto(3, Q\0\0\0008BEGIN; SET TRANSACTION ISOLATION LEVEL SERIALIZABLE\0, 57, 0, NULL, 0) = 57 -- Jon -- You received this message because you are subscribed to the Google Groups sqlalchemy group. To post to this group, send email to sqlalch

[sqlalchemy] isolation_level and psycopg2?

2010-08-09 Thread Jon Nelson
when the money is left in the hands of TAXPAYERS, God only knows what they do with it. Bake it into pies, probably. Anything to avoid creating jobs. - Dave Barry? Jon -- You received this message because you are subscribed to the Google Groups sqlalchemy group. To post to this group, send email

Re: [sqlalchemy] isolation_level and psycopg2?

2010-08-09 Thread Jon Nelson
On Mon, Aug 9, 2010 at 11:27 PM, Michael Bayer mike...@zzzcomputing.com wrote: On Aug 10, 2010, at 12:03 AM, Jon Nelson wrote: I tried setting isolation_level to SERIALIZABLE in my create_engine options, while using psycopg2. However, an strace clearly shows that it is using READ COMMITTED

[sqlalchemy] strange error with dynamic_loader

2010-08-04 Thread Jon Nelson
when the money is left in the hands of TAXPAYERS, God only knows what they do with it. Bake it into pies, probably. Anything to avoid creating jobs. - Dave Barry? Jon -- You received this message because you are subscribed to the Google Groups sqlalchemy group. To post to this group, send email

[sqlalchemy] how to translate this sql

2010-07-27 Thread Jon Nelson
this: select function_foo(BAR.x) FROM (select value1, value2, value3) BAR(x); What's the best way to emulate this with sqlalchemy? -- Jon -- You received this message because you are subscribed to the Google Groups sqlalchemy group. To post to this group, send email to sqlalch

Re: [sqlalchemy] how to translate this sql

2010-07-27 Thread Jon Nelson
On Tue, Jul 27, 2010 at 11:08 AM, Michael Bayer mike...@zzzcomputing.com wrote: On Jul 27, 2010, at 11:49 AM, Jon Nelson wrote: I have two questions: 1. I'm using postgresql, and I sometimes need to do column type conversions. In postgresql, this is normally done with the ::FOO operator

Re: [sqlalchemy] how to translate this sql

2010-07-27 Thread Jon Nelson
On Tue, Jul 27, 2010 at 11:35 AM, Jon Nelson jnel...@jamponi.net wrote: On Tue, Jul 27, 2010 at 11:08 AM, Michael Bayer mike...@zzzcomputing.com wrote: On Jul 27, 2010, at 11:49 AM, Jon Nelson wrote: I have two questions: 1. I'm using postgresql, and I sometimes need to do column type

Re: [sqlalchemy] problem with select([table.c.column1, table.c.column1])

2010-06-22 Thread Jon Nelson
On Tue, Jun 22, 2010 at 8:55 AM, Michael Bayer mike...@zzzcomputing.com wrote: On Jun 21, 2010, at 7:52 PM, Jon Nelson wrote: On Mon, Jun 21, 2010 at 5:55 PM, Michael Bayer mike...@zzzcomputing.com wrote: not a bug, that's the correct behavior. Can you explain how it is correct? I asked

[sqlalchemy] problem with select([table.c.column1, table.c.column1])

2010-06-21 Thread Jon Nelson
, Column, INT, MetaData e = create_engine('sqlite://') meta = MetaData(bind=e) t = Table( 'test', meta, Column( 'c1', INT() ) ) meta.create_all() print select([t.c.c1, t.c.c1]) I expected: SELECT test.c1, test.c1 FROM test I got: SELECT test.c1 FROM test -- Jon -- You received this message

Re: [sqlalchemy] problem with select([table.c.column1, table.c.column1])

2010-06-21 Thread Jon Nelson
it for what ultimately becomes an insert into () select (this, that, theother, col1, col1) On Jun 21, 2010, at 5:35 PM, Jon Nelson wrote: I'm encountering a problem with SA 0.6.1 I have a select statement which selects the same column twice (and some other stuff, too). However, when the query

[sqlalchemy] Window function support?

2010-05-24 Thread Jon Nelson
? -- Jon -- You received this message because you are subscribed to the Google Groups sqlalchemy group. To post to this group, send email to sqlalch...@googlegroups.com. To unsubscribe from this group, send email to sqlalchemy+unsubscr...@googlegroups.com. For more options, visit this group

[sqlalchemy] constant tables / VALUES expression

2010-05-17 Thread Jon Nelson
How do I translate the following: select A.column, V.queried from A, (VALUES ( ('foo'), ('bar') )) as V (queried) where A.column2 = V.queried; into sqlalchemy-speak. I'm not using the ORM. http://www.postgresql.org/docs/8.4/static/sql-values.html -- Jon -- You received this message because

Re: [sqlalchemy] constant tables / VALUES expression

2010-05-17 Thread Jon Nelson
seems to indicate that that is a performance impact of using VALUES with lots of values. Does anybody know what lots means? 50,000? 500,000? 14? -- Jon -- You received this message because you are subscribed to the Google Groups sqlalchemy group. To post to this group, send email to sqlalch

Re: [sqlalchemy] constant tables / VALUES expression

2010-05-17 Thread Jon Nelson
nice to get in your result sets the names that one might prefer. -- Jon -- You received this message because you are subscribed to the Google Groups sqlalchemy group. To post to this group, send email to sqlalch...@googlegroups.com. To unsubscribe from this group, send email to sqlalchemy

Re: [sqlalchemy] constant tables / VALUES expression

2010-05-17 Thread Jon Nelson
On Mon, May 17, 2010 at 9:32 AM, Michael Bayer mike...@zzzcomputing.com wrote: On May 17, 2010, at 10:14 AM, Jon Nelson wrote: On Mon, May 17, 2010 at 8:58 AM, Michael Bayer mike...@zzzcomputing.com wrote: it is here: http://groups.google.com/group/sqlalchemy/browse_thread/thread

[sqlalchemy] insert() and sa.func.something

2010-05-03 Thread Jon Nelson
? I've been using: conn.execute( table.insert(), **row ) -- Jon -- You received this message because you are subscribed to the Google Groups sqlalchemy group. To post to this group, send email to sqlalch...@googlegroups.com. To unsubscribe from this group, send email to sqlalchemy+unsubscr

[sqlalchemy] best-practices question

2010-03-30 Thread Jon Nelson
table? What alternatives are there? -- Jon -- You received this message because you are subscribed to the Google Groups sqlalchemy group. To post to this group, send email to sqlalch...@googlegroups.com. To unsubscribe from this group, send email to sqlalchemy+unsubscr...@googlegroups.com

[sqlalchemy] Re: executemany + postgresql

2009-11-07 Thread Jon Nelson
: ... return self.dbapi.connect(*cargs, **cparams) sqlalchemy.exc.DBAPIError: (TypeError) connect() takes at least 1 non-keyword argument (0 given) None None -- Jon --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google

[sqlalchemy] Re: executemany + postgresql

2009-11-07 Thread Jon Nelson
On Sat, Nov 7, 2009 at 11:58 AM, Michael Bayer mike...@zzzcomputing.com wrote: On Nov 7, 2009, at 12:53 PM, Jon Nelson wrote: have you asked about this on the psycopg2 mailing list ?   its at http://mail.python.org/mailman/listinfo/python-list  .   Let me know if you do, because I'll get

[sqlalchemy] Re: executemany + postgresql

2009-11-07 Thread Jon Nelson
On Sat, Nov 7, 2009 at 3:02 PM, Michael Bayer mike...@zzzcomputing.com wrote: On Nov 7, 2009, at 1:30 PM, Jon Nelson wrote:  File pg8000/protocol.py, line 121, in serialize    val = struct.pack(!i, len(val) + 4) + val UnicodeDecodeError: 'ascii' codec can't decode byte 0x8d in position 3

[sqlalchemy] Re: executemany + postgresql

2009-11-05 Thread Jon
On Nov 5, 8:40 pm, Michael Bayer mike...@zzzcomputing.com wrote: On Nov 5, 2009, at 8:46 PM, Jon Nelson wrote: I recently ran into an issue today where batched (inside a transaction) I was able to achieve not more than about 9000 inserts/second to a postgresql database (same machine

[sqlalchemy] Re: Nested transactions with SQLAlchemy and sqlite

2009-11-02 Thread Jon Black
that it's not supported in pysqlite. So perhaps we need to talk with them? 2009/11/1 Michael Bayer mike...@zzzcomputing.com On Nov 1, 2009, at 4:13 AM, Jon wrote: I'm writing an application in python using sqlalchemy (and Elixir) with sqlite as the database backend. I start a new transaction

[sqlalchemy] Re: Nested transactions with SQLAlchemy and sqlite

2009-11-02 Thread Jon Black
I've also found this as well, which references the previous link: http://www.mail-archive.com/sqlalchemy@googlegroups.com/msg15411.html 2009/11/2 Jon Black juan.bl...@gmail.com A quick search on google revealed this: http://74.125.77.132/search?q=cache:YB8OTfrO6xAJ:itsystementwicklung.de

[sqlalchemy] Nested transactions with SQLAlchemy and sqlite

2009-11-01 Thread Jon
I'm writing an application in python using sqlalchemy (and Elixir) with sqlite as the database backend. I start a new transaction using the code session.begin_transaction(), but when I call session.rollback () I get the following error: sqlalchemy.exceptions.OperationalError: (OperationalError)

[sqlalchemy] reflected tables and defaults

2009-09-28 Thread Jon Nelson
if no Engine association currently exists. -- Jon --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups sqlalchemy group. To post to this group, send email to sqlalchemy@googlegroups.com To unsubscribe from this group, send

  1   2   >