Re: [sqlalchemy] move objects between two sessions

2017-04-09 Thread A.M.
On 04/09/2017 10:52 AM, SG wrote: > I have two databases with one session for each of them. > I would like to move objects contained in one of them to the other. > I tried to get an object from the first with something like: > > | > obj =sessionA.query(MyClass).filter(MyClass.name=='some name') >

Re: [sqlalchemy] Proper way to do processing across entire db?

2013-02-21 Thread A.M.
On Thu, 21 Feb 2013 12:52:42 -0800 (PST), Victor Ng vicng...@gmail.com wrote: I do a lot of processing on large amount of data. The common pattern we follow is: 1. Iterate through a large data set 2. Do some sort of processing (i.e. NLP processing like tokenization, capitalization,

Re: [sqlalchemy] SELECT * FROM function() with declarative

2012-09-20 Thread A.M.
On Sep 20, 2012, at 11:49 AM, David McKeone wrote: I've googled around can't seem to find an answer to this, so hopefully someone knows how to do it here. I'm using PostgreSQL and I have a PL/PGSQL function that filters and modifies a particular table based on a number of conditions and

Re: [sqlalchemy] [PATCH] MATCH clause implementation for foreign keys

2012-06-10 Thread A.M.
On Jun 9, 2012, at 10:41 PM, Michael Bayer wrote: it looks great. This is in the queue as http://www.sqlalchemy.org/trac/ticket/2502. 1765text += MATCH %s % constraint.match SQL injection? Shouldn't the argument be one of three constants? I suspect there needs to be

Re: [sqlalchemy] Lock table, do things to table, unlock table: Best way?

2012-05-27 Thread A.M.
On May 27, 2012, at 1:07 AM, Jeff wrote: I have multiple processes accessing a table. All of these processes want to read a set of rows from the table, and if the rows are not present they will make a calculation and insert the rows themselves. The issue comes where process A does a query

Re: [sqlalchemy] modifying enable_seqscan option

2012-03-15 Thread A.M.
On Mar 15, 2012, at 5:54 AM, Eduardo wrote: Hi, Is it possible to set this option to off by using sqlalchemy? Thanks Ed connection.execute(SET enable_seqscan TO off;) But if you use that in production, you're nuts. Cheers, M -- You received this message because you are subscribed to

Re: [sqlalchemy] postgres with .. select queries

2012-03-01 Thread A.M.
On Mar 1, 2012, at 9:41 AM, Michael Bayer wrote: Right.. So what should I do about oracle CONNECT BY, which is what they have instead of WITH RECURSIVE... Consider that to be a different construct and ignore it for now? Or should there be some approach that approximates between WITH

Re: [sqlalchemy] Reducing instrumentation overhead for read-only entities

2012-02-26 Thread A.M.
On Feb 19, 2012, at 5:24 AM, Andrey Popp wrote: Regarding rationale let me describe where I can find this feature useful: * You have a part of you tables read-only, so you only query data from them. SQLAlchemy doesn't have to track changes on objects of classes mapped to these

Re: [sqlalchemy] 0.7.4 and multiple schemas

2012-01-24 Thread A.M.
On Jan 24, 2012, at 11:08 AM, Julien Cigar wrote: Hello, I upgraded to 0.7.4 together with PostgreSQL 9.0.5. I have a database with several schemas, and it looks like the handle of schemas changed in 0.7.4 I altered the default database search_path with: {{{ xxx=# alter DATABASE

Re: [sqlalchemy] Declaring compound primary key on reflective model

2011-06-10 Thread A.M.
On Jun 10, 2011, at 2:25 PM, Cody Django wrote: Hi all -- I'm new on pylons, coming from a django background. I'm working on a mapfish project. I'd like to autoload a model based on a db table, but in doing so I get the error could not assemble any primary key columns for mapped table.

Re: [sqlalchemy] Concurrent upsert problem with session.merge()

2011-06-07 Thread A.M.
On Jun 7, 2011, at 7:17 AM, Vlad K. wrote: Hi all! I have a daily stats table with the date as primary key. Currently the date is string in the MMDD format, but I'll probably port it to a Date type for easier statistical analysis. Other cols are various counters that get

Re: [sqlalchemy] Exclusive SELECT?

2011-06-01 Thread A.M.
On Jun 1, 2011, at 12:56 AM, thatsanicehatyouh...@mac.com wrote: Hi, I'm working on a script using SQLAlchemy against a PostgreSQL database and using Python's multiprocessing. The pattern is for each thread to: - start a transaction (session.begin()) - retrieve the next row in table X

Re: [sqlalchemy] In-memory sqlite database to blob?

2011-03-04 Thread A.M.
On Mar 4, 2011, at 4:50 PM, thatsanicehatyouh...@mac.com wrote: Hi, I'd like to write a script that creates an in-memory SQLite database via SQLAlchemy, but when I've finished with it I'd like to upload it as a file to a server, preferably without ever creating a temporary file on the

[sqlalchemy] autoloading with known columns

2011-02-02 Thread A.M.
Hello, I am using autoload to load some of my application metadata for views, however, since some information cannot be extracted from the view (such as the primary key) and because one UserDefinedType I am using cannot be recognized using reflection, I am passing certain column information

[sqlalchemy] Re: autoloading with known columns

2011-02-02 Thread A.M.
On Feb 2, 2011, at 4:50 PM, A.M. wrote: Hello, I am using autoload to load some of my application metadata for views, however, since some information cannot be extracted from the view (such as the primary key) and because one UserDefinedType I am using cannot be recognized using

Re: [sqlalchemy] Sqlite3 auto

2011-01-28 Thread A.M.
On Jan 28, 2011, at 8:07 AM, slothy Rulez a lot wrote: Hi, [] I'm trying to create tables in SQLITE, with a composite PK (id, eid), I want the id have the auto increment. I've read this, http://www.sqlalchemy.org/docs/dialects/sqlite.html#auto-incrementing-behavior, and following your

Re: [sqlalchemy] autocommit on for DDL

2011-01-27 Thread A.M.
On Jan 26, 2011, at 7:47 PM, Michael Bayer wrote: On Jan 26, 2011, at 6:32 PM, A.M. wrote: Well, I spoke too soon :( What is the mistake in the following sample code which causes the COMMITs to be emitted? Setting autocommit to either True or False emits the same SQL. I think

[sqlalchemy] autocommit on for DDL

2011-01-26 Thread A.M.
Hello, While working on a database test with nose, I dug into sqlalchemy 0.6.6 until I found these lines: class DDLElement(expression.Executable, expression.ClauseElement): Base class for DDL expression constructs. _execution_options = expression.Executable.\

Re: [sqlalchemy] autocommit on for DDL

2011-01-26 Thread A.M.
On Jan 26, 2011, at 5:45 PM, Michael Bayer wrote: From this it follows that if you'd like to emit several DDL statements in a transaction, the usage is no different for DDL expressions than for any other kind of DML statement (i.e insert/update/delete). Use

Re: [sqlalchemy] autocommit on for DDL

2011-01-26 Thread A.M.
Well, I spoke too soon :( What is the mistake in the following sample code which causes the COMMITs to be emitted? Setting autocommit to either True or False emits the same SQL. I think this is a case of staring at the same code too long causing brain damage- thanks for your patience and help!

Re: [sqlalchemy] Inserting in a container class that behaves as list (or set) from the contained class (not from the container)

2011-01-21 Thread A.M.
On Jan 21, 2011, at 12:29 PM, Hector Blanco wrote: Hello list! I have a couple of classes. One of the behaves as the container of the other: class ContainerOfSamples(declarativeBase): __tablename__ = containers _id = Column(id, Integer, primary_key=True) _samples =

[sqlalchemy] On creating new SchemaItems

2011-01-21 Thread A.M.
Hello, I would like SQLAlchemy to generate views much in the same way it can generate tables- perhaps like this: View('bob',select([...])) Is the SQLAlchemy code modular enough to support a user-defined SchemaItem or does that require changes to SQLAlchemy itself? The reason I would very

Re: [sqlalchemy] On creating new SchemaItems

2011-01-21 Thread A.M.
On Jan 21, 2011, at 1:36 PM, Michael Bayer wrote: On Jan 21, 2011, at 12:56 PM, A.M. wrote: Hello, I would like SQLAlchemy to generate views much in the same way it can generate tables- perhaps like this: View('bob',select([...])) Is the SQLAlchemy code modular enough to support

Re: [sqlalchemy] scalar association_proxy

2011-01-19 Thread A.M.
On Jan 19, 2011, at 12:52 PM, AgentOrange wrote: Hi Folks, I have been scratching my head over this one all day, so any advice would be greatly appreciated! I have a pretty simple join table setup like this: foo foo_bar bar

Re: [sqlalchemy] Re: scalar association_proxy

2011-01-19 Thread A.M.
On Jan 19, 2011, at 1:29 PM, AgentOrange wrote: Hi ho, Thanks for the swift reply! Did you use uselist=False on foo.bar and the associationproxy? It would nice if you could show some code.http://www.sqlalchemy.org/docs/orm/extensions/associationproxy.html?h... Yes I did. The code

Re: [sqlalchemy] dirtying attributes of a user-defined type

2011-01-14 Thread A.M.
On Jan 14, 2011, at 3:26 PM, A.M. wrote: I suspect I have to implement special converter methods with psycopg2 register_adapter/new_type. That is what I am experimenting with now. It looks like SQLAlchemy's array type support doesn't support anything beyond basic built-in types that accept

[sqlalchemy] dirtying attributes of a user-defined type

2011-01-13 Thread A.M.
Hello, I have created an SQLAlchemy type which represents a postgresql aclitem (which represents postgresql access control lists). I am able to load and save newly-created ACLItems from the database, however, modifying the values of an instance of the type does not dirty it for flushing. Is

[sqlalchemy] Re: complex mapped collection

2010-12-13 Thread A.M.
On Sep 14, 2010, at 5:03 PM, A.M. wrote: Hello, I have a schema like this: Image *id *name Metadatakey *id *exifkey *name Metadata *id *image_id - Image *metadatakey_id - Metadatakey *value Thanks to Michael Bayer, I was able to put together the image metadata model I

Re: [sqlalchemy] Implementing fine-grained access control

2010-11-22 Thread A.M.
On Nov 22, 2010, at 9:30 AM, Dan Ellis wrote: I'd like to find some way to implement access controls on mapped objects, with the following features: * Example: given a BlogPost object, only the owner, or a superuser, would be allowed to set fields such as title and body. * Example:

Re: [sqlalchemy] association_proxy as property?

2010-11-16 Thread A.M.
On Nov 16, 2010, at 11:43 AM, Michael Bayer wrote: On Nov 16, 2010, at 11:14 AM, A.M. wrote: Hello, To generate json from our SQLAlchemy model objects, we are using iterate_properties to determine how to dictify the object. One of our objects uses association_proxy which we would

Re: [sqlalchemy] Database Views

2010-11-08 Thread A.M.
On Nov 8, 2010, at 1:16 PM, Adrian wrote: Hi all, This is a topic that has been discussed before, but I haven't been able to successfully implement any of the proposed solutions in my own code. I've created a few Views in my postgres database, and I'm looking for a way to simply query

Re: [sqlalchemy] Locking strategy

2010-09-30 Thread A.M.
On Sep 30, 2010, at 10:02 AM, Michael Bayer wrote: On Sep 30, 2010, at 4:43 AM, Warwick Prince wrote: Hi All I would like some advice / best practice on the following basic problem please. I'm new to SQL so am groping with some things that used to be basic. :-( I've looked

[sqlalchemy] postgresql EXCLUDE constraint

2010-09-23 Thread A.M.
Hello, I am using this PostgreSQL exclusion constraint: CONSTRAINT only_one_valid EXCLUDE USING (synthetic_id WITH =,COALESCE(obsoleteby,'') WITH =), How can I represent this using SQLAlchemy Table metadata so that I can create the table from the metadata? Cheers, M -- You received this

Re: [sqlalchemy] Setting the starting value of an autoincrement field?

2010-09-20 Thread A.M.
On Sep 20, 2010, at 11:00 PM, Russell Warren wrote: Is there a way in the standard SQLA dialect support to set the starting value of an autoincrement field in the SQLA table definition? I can't see anything in the docs or code, but something like this is what I'm thinking: empnum =

Re: [sqlalchemy] Use regexp in like

2010-09-17 Thread A.M.
On Sep 17, 2010, at 11:12 AM, Michael Bayer wrote: On Sep 17, 2010, at 10:58 AM, Michael Bayer wrote: On Sep 17, 2010, at 9:14 AM, Michael Hipp wrote: On 9/14/2010 2:23 PM, Michael Hipp wrote: Is it possible to use a regexp in a like() clause? Or some other way to achieve