[sqlalchemy] Re: Replicating a transaction

2007-03-20 Thread sdobrev

On Tuesday 20 March 2007 07:47:53 Benno Rice wrote:
 Hi,

 I'm wondering if it would be possible to have a situation where
 transactions coming in from the ORM system could be sent to
 multiple database servers at once.

 If I were to look into adding this, where would be the best place
 to start?


although i'm not the authority to answer, i would probably subclass 
Engine and makeing it multi-sub-engine.

Don't know how diff.dialects will be tackled though.. e.g one db is 
sqlite for quick and dirty caching, another is oracle for secure 
back-storage, etc. 

Also no idea how would u synchronise the db-responses, i.e. when to 
consider a transaction ready - when 1st db is ready, or when last db 
is ready etc. Same for errors - if one db throws and others do not..

i guess this can be ery usable also for full-replication mechanisms.

svil

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~--~~~~--~~--~--~---



[sqlalchemy] Re: How to model an odd many-to-many relationship?

2007-03-20 Thread Gaetan de Menten

On 3/20/07, Mike Kent [EMAIL PROTECTED] wrote:

 I have a many-to-many relationship between two entities, call them A
 and B.  This is easy enough to model in sqlalchemy using Elixir.
 However, to complicate things, I need an integer column somewhere
 called 'priority'.  In the relationship between an A and multiple Bs,
 I want the Bs to be ordered by the value of the 'priority' column.  In
 the relationship between a B and multiple As, the value of 'priority'
 is irrelevant.

 The problem is, I don't know what entity needs to have the 'priority'
 column in it, or how to model this in the relationship between A and
 B.  I thought that maybe the 'priority' column should be in the
 secondary table that handles the many-to-many relationship between A
 and B, but I'm not sure how to set that up, and I'm not sure that
 Elixir can handle that at all.

Basically Elixir doesn't handle that case. For now, your only option
is to make a separate entity for the intermediary table, which would
hold two belongs_to relationships, and use has_many relationships in
your existing entities (A and B) to that new entity, instead of using
has_and_belongs_to_many relationships.

Now on the SQLAlchemy's side, you can either use that solution too, or
use an AssociationProxy. See:

 http://www.sqlalchemy.org/docs/plugins.html#plugins_associationproxy

I personally feel the associationproxy should be better integrated
into the normal relation function (preferably as an option), but
Michael Bayer doesn't agree with me on this. My point is that
many-to-many relationship are already doing some kind of
associationproxy behind the scenes, so I don't see why you should use
an immensely different way to set things up simply because you have
extra fields in your intermediary table.

As for Elixir, I've been thinking to integrate the associationproxy
into the has_and_belongs_to_many relationship for some time now. I'll
do it if enough people are interested.

-- 
Gaëtan de Menten
http://openhex.org

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~--~~~~--~~--~--~---



[sqlalchemy] Fix on ADODBAPI

2007-03-20 Thread El Gringo

I found that the conenctionString is not complete, the port is
missing. Not like anywhere else, host and port must be separated by a
comma !


def make_connect_string(keys):
connectors = [Provider=SQLOLEDB]
connectors.append (Data Source=%s,%s % (keys.get(host),
keys.get(port, 1433)))
connectors.append (Initial Catalog=%s % keys.get(database))
user = keys.get(user)
if user:
connectors.append(User Id=%s % user)
connectors.append(Password=%s % keys.get(password, ))
else:
connectors.append(Integrated Security=SSPI)
return [[;.join (connectors)], {}]


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~--~~~~--~~--~--~---



[sqlalchemy] Re: SELECT 'a fixed string', ...

2007-03-20 Thread jose

Bertrand Croq wrote:

hi,

I am currently using sqlalchemy to build SQL queries and it's a fantastic 
tool! By now, I am looking for a way to build:

 SELECT 'a_fixed_string', atable.col1, atable.col2
 FROM atable

using the syntax:

 select([XXX, atable.c.col1, atable.c.col2])

but I don't know what to put at XXX.

Does anyone have a clue 
  

try this:

select([literal('a_fixed_string'), atable.c.col1, atable.c.col2])

jo


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~--~~~~--~~--~--~---



[sqlalchemy] Re: Fix on ADODBAPI

2007-03-20 Thread El Gringo


I also found that when trying to connect within a thread the
connection hangs. I had to use pythoncom.CoInitialize().

Example:
#
import pythoncom
import sys

sys.coinit_flags = 0
pythoncom.CoInitialize()
[ COM code here... ]
pythoncom.CoUninitialize()

More informations:
http://twistedmatrix.com/pipermail/twisted-python/2004-June/007997.html


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~--~~~~--~~--~--~---



[sqlalchemy] Re: SELECT 'a fixed string', ...

2007-03-20 Thread Bertrand Croq

Le Mardi 20 Mars 2007 10:38, jose a écrit :
 try this:

 select([literal('a_fixed_string'), atable.c.col1, atable.c.col2])

Perfect ! Thanks a lot.

-- 
Bertrand Croq,
Ingénieur Développement
___
Net-ng  Tel  : +33 (0)223 21 21 52
Immeuble Germanium  Fax  : +33 (0)223 21 21 60
80 av. des Buttes de CoesmesWeb   : http://www.net-ng.com
35000 RENNESe-mail: [EMAIL PROTECTED]
FRANCE


Ce message et tout document joint sont confidentiels. Toute diffusion ou
publication en est interdite. Si vous recevez ce message par erreur,
merci d'en avertir immédiatement l'expéditeur par e-mail et de
supprimer ce message et tout document joint.

This message and any attachment are confidential. Any use is prohibited
except formal approval. If you receive this message in error, please
notify the sender by return e-mail and delete this message and any
attachment from your system.



--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~--~~~~--~~--~--~---



[sqlalchemy] Re: migrate tool

2007-03-20 Thread che

Thanks Evan,
Hope that soon I'll use your tool.
Stefan


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~--~~~~--~~--~--~---



[sqlalchemy] Re: Issue using rev 2425

2007-03-20 Thread Steve Zatz

Michael, thanks for working through this and for taking the time to
explain what's going on and to provide alternative ways to getting
this done.  Your efforts to support the users of sqlalchemy are really
extraordinary.

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~--~~~~--~~--~--~---



[sqlalchemy] Re: How to model an odd many-to-many relationship?

2007-03-20 Thread Mike Kent

Gaetan,

Thanks for your response.  I'd like to follow up with two questions:

1. I understand what you mean about the current way I'd have to model
this relationship
in Elixir.  This would allow me full control over the intermediate
table, which means I could
put my 'priority' field in it.  However, I believe this will also
prevent me from getting 'all Bs for a given A, in priority order',
by simply accessing the correct property in an A.  Instead, when
accessing that property, I could get all occurances of the
intermediate table for an A.  Can you give me some idea of how I would
set up a select that would give me all Bs for an A, in 'priority'
order?

2. When you talk about 'Now on the SQLAlchemy side', it makes me thing
that in addition to setting up the relationships in Elixir as you
specified, I would also need to do something directly in SQLAlchemy.
Is that what you meant, or am I misinterpreting you?

Finally, I do hope you will add the capability for finer-grained
control over the intermediate table of a many-to-many relationship to
Elixir.  I would think that this kind of ordered many-to-many
relationship is a prevalent enough use case to warrant it.


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~--~~~~--~~--~--~---



[sqlalchemy] Re: [ticket:336] Informix support and some enhancement for oracle and pgsql

2007-03-20 Thread junzhang . jn

 label length of 18 is very small, we might have to resolve ticket  
 #512 first (makes the truncation size non-global).
please check my patch.
we add a attribute in dialet for this case.



--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~--~~~~--~~--~--~---



[sqlalchemy] Re: small bug/feature in PassiveDefault for timestamp in MySQL (or am I doing something wrong?)

2007-03-20 Thread Michael Bayer

mysql.py gets MSTimestamp added, which probably subclasses  
MSDateTime,  which sends along TIMESTAMP, and gets a fix in  
ischema_names to support reflection.  colspecs dict gets  
sqltypes.TIMESTAMP: MSTimestamp added.

*perhaps*, types.py should have Timestamp added to it, TIMESTAMP will  
subclass Timestamp.  but i dont think this is needed quite yet.

can you send me a patch ?

On Mar 20, 2007, at 11:11 AM, eppye wrote:



 I'm using SQLalchemy 0.3.4 with MySQL 5.0 and MySQLdb 1.2.2  and try
 to insert this table:

 tas = Table(
'ta', metadata,
Column('idta',Integer,primary_key=True,autoincrement=False),
Column('ts',TIMESTAMP,PassiveDefault(text(CURRENT_TIMESTAMP))),

 I get the next error (did some formatting on it):
 sqlalchemy.exceptions.SQLError: (OperationalError) (1067, Invalid
 default value for 'ts')
'\nCREATE TABLE ta (
\n\tidta INTEGER NOT NULL,
\n\tts DATETIME DEFAULT CURRENT_TIMESTAMP,
\n\tPRIMARY KEY (idta)\n
) ENGINE=InnoDB\n\n' ()

 MySQL does not accept this.
 When using SQL-directly this SQL is accepted:
 '''CREATE TABLE ta (
idtaINTEGER   NOT NULL,
ts  TIMESTAMP   DEFAULT
 CURRENT_TIMESTAMP,
PRIMARY KEY (idta)
)

 Then I realised that SQLAlchemy passes a TIMESTAMP as DATETIME.
 I fixed this in databases\mysql.py  so SQLAlchemy now passes
 TIMESTAMP;
 and all goes OK.

 Is this a 'bug',  a feature or is there a better way?

 Best regards,

 eppye


 


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~--~~~~--~~--~--~---



[sqlalchemy] Re: Replicating a transaction

2007-03-20 Thread Michael Bayer

SessionTransaction will start transactions across any number of  
databases, as different engines come into its querying scope.   when  
SessionTranasction commits, it commits all underlying transacitons.   
so if you want to start all transactions at once, you can create a  
new SessionTransaction, and just add() each engine you want.  at the  
point of add(), it  retrieves a connection from the pool and calls  
begin() on it.

however, this is not using two phase commit, which means that if one  
commit fails, all previous commit's stay committed.  if you want true  
two phase commit I'd look into Zalchemy which has this feature.

On Mar 20, 2007, at 1:47 AM, Benno Rice wrote:


 Hi,

 I'm wondering if it would be possible to have a situation where
 transactions coming in from the ORM system could be sent to multiple
 database servers at once.

 If I were to look into adding this, where would be the best place to
 start?

 Many thanks.

 -- 
 Benno Rice
 [EMAIL PROTECTED]
 http://jeamland.net/



 


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~--~~~~--~~--~--~---



[sqlalchemy] Re: Replicating a transaction

2007-03-20 Thread Michael Bayer


On Mar 20, 2007, at 11:52 AM, Michael Bayer wrote:

 however, this is not using two phase commit, which means that if one
 commit fails, all previous commit's stay committed.  if you want true
 two phase commit I'd look into Zalchemy which has this feature.

actually i should correct myself - technically the commit strategy  
inside of SessionTransaction is more or less equivalent to what  
Zalchemy is doing right now - when you say trans.commit(), flush()  
will be called on the underlying session which will issue SQL to all  
involved databases.  *then* it will go through and commit each  
database individually.  since all SQL has been issued, its usually*  
the case that any exceptions that would have been raised have been  
raised already, and the commits are guaranteed** to succeed.

* if you have your database set up to defer constraint checking until  
commit, then this wont work; exceptions will all get thrown at the  
COMMIT phase.  zalchemy doesnt solve this either.
** guaranteed as close as we can get without accessing a true two- 
phase API on the database itself, which AFAICT is not possible with  
DBAPI.   also if constraint checking is deferred until commit, like  
above the whole strategy fails.

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~--~~~~--~~--~--~---



[sqlalchemy] Dealing with uncommited data

2007-03-20 Thread Andreas Jung
In a traditional application you can insert a new row and read the row 
within the same transaction. What is the typical usage pattern to deal with 
this in SA? In our particular setup (Zope) a new session is created for

each new HTTP request and flushed automatically at the end of request when
Zope commits the transaction. A solution might be to flush the session
explicitly in such a case however I don't think that this is a smart idea.
Any better idea?

Andreas


pgp3WFPsVJhgb.pgp
Description: PGP signature


[sqlalchemy] Re: Dealing with uncommited data

2007-03-20 Thread Marco Mariani

Andreas Jung wrote:
 In a traditional application you can insert a new row and read the row
 within the same transaction. What is the typical usage pattern to deal
 with this in SA? In our particular setup (Zope) a new session is
 created for
 each new HTTP request and flushed automatically at the end of request
 when
 Zope commits the transaction. A solution might be to flush the session
 explicitly in such a case however I don't think that this is a smart
 idea.
 Any better idea?
You can call session.flush() in between. This writes to the transaction
but does not commit anything yet

If you need to directly query the tables afterwards (triggers, text
query, whatever), but inside the same transaction:

session.flush()
conn = session.context.get_current().connection(SomeMappedClass)
conn.execute(sa.select(...)...)



(at least, works for me with turbogears that wraps requests with
transactions the same way as zope)


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~--~~~~--~~--~--~---



[sqlalchemy] table name/Foreign key

2007-03-20 Thread vkuznet

Hi,
I have a dump question about naming conventions for foreign keys.

Using ORACLE as back-end all table names are in capital letters. So
Table object looks like:
Table('BRANCH',DynamicMetaData(),Column('id',OracleInteger(),primary_key=True,nullable=False),
Column('name',OracleString(length=500),nullable=False),
Column('lastmodifiedby',OracleInteger(),
ForeignKey('person.id')),
Column('lastmodificationdate',OracleTimestamp(timezone=False),
default=PassiveDefault(sqlalchemy.sql._TextClause object at
0xb6b142ac)),
Column('creationdate',OracleTimestamp(timezone=False),
default=PassiveDefault(sqlalchemy.sql._TextClause object at
0xb6b1430c)),
Column('createdby',OracleInteger(),ForeignKey('person.id')),schema=None)

The question is why Foreign key is in lower case, since the table
person name is actually in capital
Table('PERSON',DynamicMetaData())

Thanks,
Valentin.


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~--~~~~--~~--~--~---



[sqlalchemy] Re: table name/Foreign key

2007-03-20 Thread Michael Bayer

it would appear the query to read back constraint information is:

SELECT
  ac.constraint_name,
  ac.constraint_type,
  LOWER(loc.column_name) AS local_column,
  LOWER(rem.table_name) AS remote_table,
  LOWER(rem.column_name) AS remote_column,
  LOWER(rem.owner) AS remote_owner
FROM all_constraints%(dblink)s ac,
  all_cons_columns%(dblink)s loc,
  all_cons_columns%(dblink)s rem
WHERE ac.table_name = :table_name
AND ac.constraint_type IN ('R','P')
AND ac.owner = :owner
AND ac.owner = loc.owner
AND ac.constraint_name = loc.constraint_name
AND ac.r_owner = rem.owner(+)
AND ac.r_constraint_name = rem.constraint_name(+)
-- order multiple primary keys correctly
ORDER BY ac.constraint_name, loc.position, rem.position

so...theres your lower case.


On Mar 20, 2007, at 4:38 PM, vkuznet wrote:


 Hi,
 I have a dump question about naming conventions for foreign keys.

 Using ORACLE as back-end all table names are in capital letters. So
 Table object looks like:
 Table('BRANCH',DynamicMetaData(),Column('id',OracleInteger 
 (),primary_key=True,nullable=False),
 Column('name',OracleString(length=500),nullable=False),
 Column('lastmodifiedby',OracleInteger(),
 ForeignKey('person.id')),
 Column('lastmodificationdate',OracleTimestamp(timezone=False),
 default=PassiveDefault(sqlalchemy.sql._TextClause object at
 0xb6b142ac)),
 Column('creationdate',OracleTimestamp(timezone=False),
 default=PassiveDefault(sqlalchemy.sql._TextClause object at
 0xb6b1430c)),
 Column('createdby',OracleInteger(),ForeignKey 
 ('person.id')),schema=None)

 The question is why Foreign key is in lower case, since the table
 person name is actually in capital
 Table('PERSON',DynamicMetaData())

 Thanks,
 Valentin.


 


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~--~~~~--~~--~--~---



[sqlalchemy] Re: Feature request: Session.get_local()

2007-03-20 Thread Daniel Miller

A patch containing tests and cleaned up identity key is attached.

~ Daniel


Michael Bayer wrote:
 committed, r2409.
 
 the row needs to have a class and entity_name present to determine 
 what mapper you want to use to extract from the row, so i put those as 
 keyword arguments for now.
 
 also, I notice the usage of plain old assert for argument checking.  
 should we make this change across the board and get rid of 
 exceptions.ArgumentError ?  i feel like we have to go one way or the 
 other with that.
 
 also i didnt do any testing of this, we might want to add some tests to 
 test/orm/session.py .
 
 
 On Mar 12, 2007, at 9:21 PM, Daniel Miller wrote:
 
 def identity_key(self, *args, **kwargs):

 Get an identity key


 Valid call signatures:


 identity_key(class_, ident, entity_name=None)

 class_ - mapped class

 ident - primary key, if the key is composite this is a tuple

 entity_name - optional entity name. May be given as a

 positional arg or as a keyword arg.


 identity_key(instance=instance)

 instance - object instance (must be given as a keyword arg)


 identity_key(row=row)

 row - result proxy row (must be given as a keyword arg)

 

 if args:

 kw = {}

 if len(args) == 2:

 class_, ident = args

 entity_name = kwargs.pop(entity_name, None)

 assert not kwargs, (unknown keyword arguments: %s

 % (kwargs.keys(),))

 else:

 assert len(args) == 3, (two or three positional args are 

 accepted, got %s % len(args))

 class_, ident, entity_name = args

 mapper = _class_mapper(class_, entity_name=entity_name)

 return mapper.instance_key_from_primary_key(ident,

 entity_name=entity_name)

 else:

 try:

 instance = kwargs.pop(instance)

 except KeyError:

 row = kwargs.pop(row)

 assert not kwargs, (unknown keyword arguments: %s

 % (kwargs.keys(),))

 mapper = # not sure how to get the mapper form a row

 return mapper.identity_key_from_row(row)

 else:

 assert not kwargs, (unknown keyword arguments: %s

 % (kwargs.keys(),))

 mapper = _object_mapper(instance)

 return mapper.identity_key_from_instance(instance)

 
 
  

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~--~~~~--~~--~--~---

Index: lib/sqlalchemy/orm/session.py
===
--- lib/sqlalchemy/orm/session.py   (revision 2432)
+++ lib/sqlalchemy/orm/session.py   (working copy)
@@ -452,54 +452,57 @@
 
 identity_key(class\_, ident, entity_name=None)
 class\_
-mapped class
-
+mapped class (must be a positional argument)
+
 ident
 primary key, if the key is composite this is a tuple
 
 entity_name
-optional entity name. May be given as a
-positional arg or as a keyword arg.
+optional entity name
 
 identity_key(instance=instance)
 instance
 object instance (must be given as a keyword arg)
 
-identity_key(row=row, class=class\_, entity_name=None)
+identity_key(class\_, row=row, entity_name=None)
+class\_
+mapped class (must be a positional argument)
+
 row
 result proxy row (must be given as a keyword arg)
-
+
+entity_name
+optional entity name (must be given as a keyword arg)
 
 if args:
-kw = {}
-if len(args) == 2:
+if len(args) == 1:
+class_ = args[0]
+try:
+row = kwargs.pop(row)
+except KeyError:
+ident = kwargs.pop(ident)
+entity_name = kwargs.pop(entity_name, None)
+elif len(args) == 2:
 class_, ident = args
 entity_name = kwargs.pop(entity_name, None)
-assert not kwargs, (unknown keyword arguments: %s
-% (kwargs.keys(),))
+elif len(args) == 3:
+class_, ident, entity_name = args
 else:
-assert len(args) == 3, (two or three positional args are 
- 

[sqlalchemy] Re: [ticket:336] Informix support and some enhancement for oracle and pgsql

2007-03-20 Thread 张骏

 unit tests:
   - cant remove any unit tests - many of them are commented out here
I will check the whole unit tests to fix the comment blocks.

   - changing identifier names in unit tests to handle informix ident -  
  e maybe, would rather informix skip those
the old test may shrink the length of table name or field name but this 
need more work.
maybe we can skip them in the beginning.

 sql.py:
   - i want to implement ticket #512.  the way youre doing it still  
 wont work for selectables that have no engine attached (which is a  
 major use case).
   ive been thinking a lot about 512 and i will bump it up in  
 priority...i want to release 0.3.6 so that people can start breaking  
 all the latest code, then ill
   do 512 which is going to change some internals significantly.
   en, i can fix the informix backend for ticket #512.

 schema.py:
   - enable argument - i dont see you using this argument.  it seems  
 to be about visitor traversal.  the visitor system has been improved  
 in the trunk
   so you can visit schema items any way you want without any flags on  
 the schema items.  definitely dont want to add anything to schema.py
our requirment is only using FK in logical level( SA ) not in database level.
when setting the enable argument's value to False , the real database will dont 
create the FK constraint.

 oracle.py:
Added DATE and TIME type support

 postgres.py:
Added SAVEPOINT support.
without SAVEPOINT support, the next code cannot run:
::python

rs = con.execute( select * from sometable1 )
for row in rs:
a = row.a
try:
con.execute( insert into sometable2( a ) values( %s ) 
, ( a ) )
except:
pass

with SAVEPOINT support:
::python
rs = con.execute( select * from sometable1 )
for row in rs:
a = row.a
try:
con.execute( insert into sometable2( a ) values( %s ) 
, ( a ) )
except:
if con.engine.name == 'postgres':
con.execute( 'rollback to sp' )


-- 
james.zhang [EMAIL PROTECTED]


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~--~~~~--~~--~--~---



[sqlalchemy] [patch] Data partitioning via bind functions

2007-03-20 Thread Benno Rice
So one thing we're attempting to do in a project I'm working on is  
partitioning our data set across several databases based on object  
keys.  I've come up with a way to implement this in SQLAlchemy which  
I've provided here as a mostly-complete patch.

Session objects now have a bind_func method which associates a  
function taking a mapper and an ORM object and returning a  
Connectable to a mapper.  When a transaction is begun on an object  
associated with that mapper, this function is called in order to work  
out which Connectable should be used to handle this object.

The main area where I haven't been able to work this through  
completely is in the dependency handling of many-to-many relationships.

I'm very interested in what people think of this and whether they  
feel it's a candidate for inclusion in SQLAlchemy.

The patch is against SQLAlchemy 0.3.5.



--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~--~~~~--~~--~--~---



sqlalchemy-partitioning.patch
Description: Binary data

-- 
Benno Rice
[EMAIL PROTECTED]
http://jeamland.net/