[sqlalchemy] Re: Help get Wikipedia entry through review

2007-03-09 Thread Hamish Lawson

The work of those who have been making the case for the article has
paid off: I see that the article is no longer marked as non-notable.
Well done!

Hamish


--~--~-~--~~~---~--~~
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: What should the future of SQLAlchemy Query look like ?

2007-03-09 Thread Glauco

Michael Bayer ha scritto:
 hey list -

 I continue to be troubled by the slightly fragmented nature of SA's
 Query object (and the cousin SelectResults).  When I work with
 Hibernate, I can see that their querying interface is a little more
 consistent than ours.  We have flags that are used for some things,
 generative methods for others.

 so id like to look into defining the next generation of query.  Id
 like it to have a quasi-generative approach, like Hibernates.  this
 means you can say:

q = q.where(something).order_by(somethingelse)

 but also, its the same as:

q.where(something)
q.order_by(somethingelse)

 so its really the same instance (this is not how SelectResults works
 at the moment).

 the whole business of using SelectResults, using SelectResultsExt, all
 that crap just to get a different API, id like to get rid of (i mean,
 itll stay there but you wont need it).  im sorry ive made you all type
 that much.

 This would be a rewrite of `Query`, and we'd leave the old one around
 in its usual place.  Im thinking we could put this newer `Query` on
 the session under the method name `select()`.

 Anyway, I put a wiki page over at http://www.sqlalchemy.org/trac/wiki/QueryV4
 , with like 2 lines of code what it might look like.

 I would like folks to comment on it, and add use cases, sample code,
 things youd like to see.  note that Im looking mostly for the Python
 API, and maybe a little bit of the method of specifying criterion, but
 not really a whole new object-query layer (like building a new HQL, or
 using AST-parsing, etc. i still think thats something else entirely).

 Please think of something to add, particularly if you are working with
 polymorphic mappings, or youve had a lot to say in past iterations
 (i.e. like dmiller, dennis, etc).  I dont want to make a move on this
 until something definitely cool and widely useful has been worked
 out.  if we just have a vague notion of something, theres no
 point...while we can prototype it, if its a side thing then not enough
 people are going to use it (and therefore valid complaints wont be
 heard) unless we parade this thing down the main aisle.  this query
 would hopefully be the last one we write for the SA core (since we are
 running out of reasonable method names on session ;) ).

   

SA is a great Work, power and useful. Only think , probably is too much 
finalised  to oneTabel - OneMapper  prototyping

For example, my purpose now is to revisiting a lot of mapper created 
from different programmers over a huge DB  so it's very important for 
maintain mappers clear, univocity in these mappers.

I found different but not equal possibility in some operation for example:

- It's not too clear because not all the features of the Table object is 
not manteined in the Mapper.

  I've 3 mapper  Amapper - Bmapper - Cmapper

- Why, if i prefer to use Mapper instead of the Tbl direct qry, i must 
anyway always explicity  the join to other mapper, for retrieve all 
selected records, Amapper.select_by( BmapperColumnCondition ) retrieve 
always  select * from A where clause so if i'm searching  something 
from B i must redesign selection qry..
  
-  Why ( aa = Amapper,  is a mapper
   bb = Bmapper,  is a mapper;
   aa.Bmapper, is a Unit of Work)  this let me use 
Amapper.c.field == x but i cannot Use Amapper.Bmapper.c.field = y



take in mind my work of maintain this huge library so if i  must upgrade 
Cmapper i don't want to manipulate ALL mapper referring to it


I hope my explanation is clear, :-) Sorry for my poor English

Glauco
-- 
++
  Glauco Uri - Programmatore
glauco(at)allevatori.com 
   
  Sfera Carta Software®  [EMAIL PROTECTED]
  Via Bazzanese,69  Casalecchio di Reno(BO) - Tel. 051591054 
++



--~--~-~--~~~---~--~~
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] How to access the value of an extra column in a many_to_many relation?

2007-03-09 Thread rwdai

Hi,

How do I access an extra column of a many_to_many table without
accessing the table directly?

My code is as follows:

query_expert_table = Table(query_expert, metadata,
 Column(query_id, Integer,
ForeignKey(query.query_id), primary_key=True),
 Column(expert_id, Integer,
ForeignKey(user.user_id), primary_key=True),
 Column(status, String(50))
)

class Query(ActiveMapper):
class mapping:
query_id = column(Integer, primary_key=True)

experts = many_to_many(User, query_expert_table,
backref=queries)


Is there an easy way of getting the status of an query-expert
relation. Something like:

 select.query(Query).get_by(query_id=1).experts[0].status ? (Which
does not work..)

Or do I always have to access the many_to_many table directly with a
new select i.e. this way?

class QueryExpert(object):
pass

mapper(QueryExpert, query_expert_table,
   primary_key=[query_expert_table.c.query_id,
query_expert_table.c.expert_id],
   properties={
'query' : relation(Query, lazy=False),
'expert' : relation(User, lazy=False)
   }
)

status = session.query(QueryExpert).get_by(and_(QueryExpert.c.query_id
== 1, QueryExpert.c.expert_id == 1)).status (Works, but is an extra
select)

I guess there must be an easier way which I have overseen...

Best,

Robert


--~--~-~--~~~---~--~~
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] SA support for SQLite ATTACH?

2007-03-09 Thread Karlo Lozovina

Greetings everyone,

does SQLAlchemy somehow support SQLites' ATTACH DATABASE statement? I
have a in-memory SQLite database that I want to dump to file, so I was
thinking of using ATTACH to do it. Any other ideas welcome ;).

Thanks in advance,
Karlo.


--~--~-~--~~~---~--~~
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: SA support for SQLite ATTACH?

2007-03-09 Thread Michael Bayer

attach database ...wow i never knew it had that !  if its a matter of
issuing the string attach database, just use literal text() or
engine.execute().

attach databasevery handy !


On Mar 9, 9:43 am, Karlo Lozovina [EMAIL PROTECTED] wrote:
 Greetings everyone,

 does SQLAlchemy somehow support SQLites' ATTACH DATABASE statement? I
 have a in-memory SQLite database that I want to dump to file, so I was
 thinking of using ATTACH to do it. Any other ideas welcome ;).

 Thanks in advance,
 Karlo.


--~--~-~--~~~---~--~~
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: InstrumentedList is not a list

2007-03-09 Thread Michael Bayer

its not always a list.  the underlying storage could be a Set, or a
dict.

there is also a ticket to enhance the typing behavior in this regard,
its #213.  although even if we make subtypes that are specific to a
collection type, actually subclassing list is somewhat inconvenient
since its a proxying object (like we dont actually need the overhead
of creating a native list instead of just object).  it would also
have to still contain inheritance to InstrumentedCollection (i.e.
multiply inherit).

might you use duck-typing instead ?  what happens if your code comes
across a UserList (also not a list) ?

On Mar 8, 8:37 pm, kris [EMAIL PROTECTED] wrote:
 sqlalchemy.orm.attributes.InstrumentedList

 I was wondering why instrumentedList is derived from
 'object' instead of 'list'?

 I working with some introspection code and it fails
 on attributes of type InstrumentedList because of this.

 Thanks,
 kris


--~--~-~--~~~---~--~~
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: What should the future of SQLAlchemy Query look like ?

2007-03-09 Thread Michael Bayer

youre looking for the mappers to express the relational concepts as
fully as Tables.  but thats what Tables are for, why not just use
them ?  SA's philosophy is very much about dont pretend theres no
database.

On Mar 9, 5:16 am, Glauco [EMAIL PROTECTED] wrote:
 Michael Bayer ha scritto:



  hey list -

  I continue to be troubled by the slightly fragmented nature of SA's
  Query object (and the cousin SelectResults).  When I work with
  Hibernate, I can see that their querying interface is a little more
  consistent than ours.  We have flags that are used for some things,
  generative methods for others.

  so id like to look into defining the next generation of query.  Id
  like it to have a quasi-generative approach, like Hibernates.  this
  means you can say:

 q = q.where(something).order_by(somethingelse)

  but also, its the same as:

 q.where(something)
 q.order_by(somethingelse)

  so its really the same instance (this is not how SelectResults works
  at the moment).

  the whole business of using SelectResults, using SelectResultsExt, all
  that crap just to get a different API, id like to get rid of (i mean,
  itll stay there but you wont need it).  im sorry ive made you all type
  that much.

  This would be a rewrite of `Query`, and we'd leave the old one around
  in its usual place.  Im thinking we could put this newer `Query` on
  the session under the method name `select()`.

  Anyway, I put a wiki page over athttp://www.sqlalchemy.org/trac/wiki/QueryV4
  , with like 2 lines of code what it might look like.

  I would like folks to comment on it, and add use cases, sample code,
  things youd like to see.  note that Im looking mostly for the Python
  API, and maybe a little bit of the method of specifying criterion, but
  not really a whole new object-query layer (like building a new HQL, or
  using AST-parsing, etc. i still think thats something else entirely).

  Please think of something to add, particularly if you are working with
  polymorphic mappings, or youve had a lot to say in past iterations
  (i.e. like dmiller, dennis, etc).  I dont want to make a move on this
  until something definitely cool and widely useful has been worked
  out.  if we just have a vague notion of something, theres no
  point...while we can prototype it, if its a side thing then not enough
  people are going to use it (and therefore valid complaints wont be
  heard) unless we parade this thing down the main aisle.  this query
  would hopefully be the last one we write for the SA core (since we are
  running out of reasonable method names on session ;) ).

 SA is a great Work, power and useful. Only think , probably is too much
 finalised  to oneTabel - OneMapper  prototyping

 For example, my purpose now is to revisiting a lot of mapper created
 from different programmers over a huge DB  so it's very important for
 maintain mappers clear, univocity in these mappers.

 I found different but not equal possibility in some operation for example:

 - It's not too clear because not all the features of the Table object is
 not manteined in the Mapper.

   I've 3 mapper  Amapper - Bmapper - Cmapper

 - Why, if i prefer to use Mapper instead of the Tbl direct qry, i must
 anyway always explicity  the join to other mapper, for retrieve all
 selected records, Amapper.select_by( BmapperColumnCondition ) retrieve
 always  select * from A where clause so if i'm searching  something
 from B i must redesign selection qry..

 -  Why ( aa = Amapper,  is a mapper
bb = Bmapper,  is a mapper;
aa.Bmapper, is a Unit of Work)  this let me use
 Amapper.c.field == x but i cannot Use Amapper.Bmapper.c.field = y

 take in mind my work of maintain this huge library so if i  must upgrade
 Cmapper i don't want to manipulate ALL mapper referring to it

 I hope my explanation is clear, :-) Sorry for my poor English

 Glauco
 --
 ++
   Glauco Uri - Programmatore
 glauco(at)allevatori.com

   Sfera Carta Software®  [EMAIL PROTECTED]
   Via Bazzanese,69  Casalecchio di Reno(BO) - Tel. 051591054
 ++


--~--~-~--~~~---~--~~
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-09 Thread Michael Bayer

my only concern is that you now have more than one way to do it.  i
need to deal with things in the identity map.  do i go look at the
session.identity_map ? (which is documented, its part of the public
API)  oh no, i dont have the exact kind of key to use, now i have to
go use a method called find() (which again, does that mean, find it
in the database ?  where is it looking ?)

the identity_map accessor on Session is pretty much only used by the
public API so yes we'd make a wrapper around the underlying dictionary/
weak dictionary.  i think its more pythonic to use property-style
access rather than methods (which in javaland feels very
dangerous...but in python, its not !  really !  heres the article that
convinced me http://dirtsimple.org/2004/12/python-is-not-java.html ).

On Mar 8, 8:13 pm, Daniel Miller [EMAIL PROTECTED] wrote:
 Michael Bayer wrote:
  fine, but the name get_local is not so descriptive and also attracts
  the focus away from the existing identity_map accessor.  how about
  we jack up the identity_map dictionary to be smarter ?  so you could
  say:

  session.identity_map.find(class_, ident, entity_name='foo')

 Are you going to make the identity_map a subclass of dict then? What about 
 the weak_identity_map option--will there be a subclass of 
 weakref.WeakValueDictionary too? That smells a bit. I guess the right way to 
 do it is to make a wrapper around the real identity_map, but then you're 
 starting to add more overhead to accessing the identity_map... Your 
 suggestion is fine from a functional point of view, it just seems to add more 
 complexity than it's worth (i.e. it would require an entire subclass (or two) 
 or a wrapper instead of just a single function).

 The identity_map has always seemed like more of an implementation detail than 
 an exposed part of the session interface (to me at least). The Session class 
 is a facade to the UnitOfWork/identity_map. When I start to write code that 
 depends heavily on those inner parts of the session I feel a bit 
 nervous--like I'm writing fragile code.

 The other thing is documenting this in a way that people will be able to 
 easily find it. The first place I would go to look for a feature like this is 
 on the session--identity_map has always had the semantics of a plain dict. 
 Would it be OK to name it session.find() and clearly document it's behavior 
 with the other similar functions like session.get() and session.load()? The 
 only possible issue is that it definitely does does NOT belong on Query 
 unlike get() and load(). I expect it will be used more with expire() and 
 expunge() so maybe that doesn't matter since neither of those methods are 
 part of the query interface either. I don't really care, I'm just giving the 
 first thoughts that come to mind here.

 ~ Daniel



  On Mar 8, 10:07 am, Daniel [EMAIL PROTECTED] wrote:
  Could we add this new method on sqlalchemy.orm.Session?

  def get_local(self, class_, ident, entity_name=None):
  Get an object from the identity map (do not hit the database)

  Returns None if the object does not exist in this session's
  identity map.
  
  idkey = self.mapper(class_,
  entity_name=entity_name).identity_key(ident)
  return self.identity_map.get(idkey)

  This is handy for doing tasks such as expiring/expunging/etc. an
  instance but only if it exists in the session. I'm not sure if it
  makes sense to have the entity_name parameter because I've never used
  it before, but I added it just in case.

  Thanks,
  ~ Daniel


--~--~-~--~~~---~--~~
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: Compressing cPickled objects == store in DB

2007-03-09 Thread Michael Bayer

why not copy the source of PickleType and add the zlib steps to its
pickling logic ?  then it would just be transparent.

On Mar 8, 8:12 pm, Andrea Gavana [EMAIL PROTECTED] wrote:
 Hi All,

 I was wondering if it is possible to use zlib.compress() to
 compress a cPickled object and store it into a database, and then
 retrieve it using zlib.decompress(). I have tried for a while, but I
 keep getting errors like:

 snip

   File build\bdist.win32\egg\sqlalchemy\engine\base.py, line 369, in 
 _execute
 sqlalchemy.exceptions.SQLError: (OperationalError) Could not decode to UTF-8 
 col
 ' 'SELECT treenodes.node_name AS treenodes_node_name, 
 treenodes.parent_node_id A
 S treenodes_parent_node_id, treenodes.node_id AS treenodes_node_id, 
 treedata_f69
 f.data_id AS treedata_f69f_data_id, treedata_f69f.value AS 
 treedata_f69f_value,
 treenodes.data_ident AS treenodes_data_ident \nFROM treenodes LEFT OUTER JOIN 
 tr
 eedata AS treedata_f69f ON treedata_f69f.data_id = treenodes.data_ident 
 \nWHERE
 treenodes.node_name = ? ORDER BY treenodes.oid, treedata_f69f.oid' 
 ['rootnode']

 I assume something like that is not possible, although it would be
 handy to reduce the size of stored objects in a database... I attach a
 small demo if someone is willing to try it. As usual, just change the
 variable newDataBase=True for the first run (no errors, but database
 looks empty, the size is only 3 Kb), and then change to
 newDataBase=False.

 Any thought?

 Andrea.

 Imagination Is The Only Weapon In The War Against 
 Reality.http://xoomer.virgilio.it/infinity77/

 [basic_tree_1.py]a basic Adjacency List model tree.

 import os
 import cPickle
 import zlib

 from sqlalchemy import *
 from sqlalchemy.util import OrderedDict

 class TreeData(object):
 def __init__(self, value=None):
 self.id = None
 self.value = value
 def __repr__(self):
 return TreeData(%s, %s) % (repr(self.id), repr(self.value))

 class NodeList(OrderedDict):
 subclasses OrderedDict to allow usage as a list-based property.
 def append(self, node):
 self[node.name] = node
 def __iter__(self):
 return iter(self.values())

 class TreeNode(object):
 a rich Tree class which includes path-based operations
 def __init__(self, name):
 self.children = NodeList()
 self.name = name
 self.parent = None
 self.id = None
 self.parent_id = None
 self.value = None

 def setdata(self, data):
 self.data = data

 def getdata(self):
 return self.data

 def append(self, node):
 if isinstance(node, str):
 node = TreeNode(node)
 node.parent = self
 self.children.append(node)

 def __repr__(self):

 return self._getstring(0, False)
 def __str__(self):
 return self._getstring(0, False)

 def _getstring(self, level, expand = False):
 s = ('  ' * level) + %s (%s,%s, %d) % (self.name, 
 self.id,self.parent_id,id(self)) + '\n'
 if expand:
 s += ''.join([n._getstring(level+1, True) for n in 
 self.children.values()])
 return s

 def print_nodes(self):
 return self._getstring(0, True)

 class TheEngine(object):

 def __init__(self, newDataBase=True):

 if newDataBase and os.path.isfile(tutorial_modified.db):
 os.remove(tutorial_modified.db)

 self.engine = create_engine('sqlite:///tutorial_modified.db', 
 echo=False)
 metadata = BoundMetaData(self.engine)

 trees = Table('treenodes', metadata,
 Column('node_id', Integer, 
 Sequence('treenode_id_seq',optional=False), primary_key=True),
 Column('parent_node_id', Integer, 
 ForeignKey('treenodes.node_id'), nullable=True),
 Column('node_name', String(50), nullable=False),
 Column('data_ident', Integer, ForeignKey('treedata.data_id'))
 )

 treedata = Table(treedata, metadata,
  Column('data_id', Integer, primary_key=True),
  Column('value', String(100), nullable=False)
  )

 mapper(TreeNode, trees, properties=dict(id=trees.c.node_id,
 name=trees.c.node_name,
 
 parent_id=trees.c.parent_node_id,
 children=relation(TreeNode, 
 cascade=all, backref=backref(parent, remote_side=[trees.c.node_id]), 
 collection_class=NodeList),
 
 data=relation(mapper(TreeData, treedata, 
 properties=dict(id=treedata.c.data_id)), 
 cascade=delete,delete-orphan,save-update, lazy=False))
)

 metadata.create_all()
 self.session = create_session()

 if newDataBase:
 self.CreateNodes()
 else:
 self.LoadNodes()

 def CreateNodes(self):

 node2 = 

[sqlalchemy] [Postgres] BIT support?

2007-03-09 Thread Andreas Jung

Hi,

are there any plans to support the BIT type of Postgres?

Andreas

pgp5Z1roj65VK.pgp
Description: PGP signature


[sqlalchemy] Re: pyodbc and tables with triggers

2007-03-09 Thread polaar

Hmmm, seems the set nocount on trick now causes problems on deletes:
ConcurrentModificationError is thrown because Updated rowcount -1
does not match number of objects updated 1.
Which seems strange because I thought rowcount -1 simply meant that
the count cannot be determined, not that there is something wrong.
There seems to be a supports_sane_rowcount check (for MySQL according
to the docs), wouldn't it make sense to treat a rowcount of -1 the
same?
Or should one just never use set nocount on when using the orm
(which would mean back to the original problem)?

Steven

On Mar 7, 5:28 pm, polaar [EMAIL PROTECTED] wrote:
 On Mar 7, 3:29 pm, Tim Golden [EMAIL PROTECTED] wrote:



  code
  from sqlalchemy import *
  metadata = BoundMetaData (mssql://VODEV1/TimHolding)
  test = Table (test, metadata, autoload=True)
  result = test.insert ().execute (code = ABC)
  print result.last_inserted_ids ()
  # = [1]
  /code

  which is what I expected. If I explicitly set NOCOUNT OFF
  for my session (in case it's on by default) using:

 metadata.engine.raw_connection ().execute (SET NOCOUNT OFF)

  then it still works.

  Is my case the situation you're describing? Or have I
  misunderstood somthing?

 My fault: I forgot to tell you that I was using a mapped class, and
 it's the sqlalchemy-generated 'select @@identity' that causes the
 problem. (you can see that it does that in the log output)


--~--~-~--~~~---~--~~
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: BIT support?

2007-03-09 Thread Michael Bayer

feel free to send a patch (its like 5 lines)

for example, heres the INET patch:

http://www.sqlalchemy.org/trac/ticket/444

On Mar 9, 11:12 am, Andreas Jung [EMAIL PROTECTED] wrote:
 Hi,

 are there any plans to support the BIT type of Postgres?

 Andreas

  application_pgp-signature_part
 1KDownload


--~--~-~--~~~---~--~~
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: Functions with out parameters?

2007-03-09 Thread Greg Copeland

Great that's working.  And Yuck!  Having to do that directly on the
cursor really makes me enjoy SA's capabilities.  Can't wait until
that's a supported feature.  Keep up the good work guys!

Greg


On Mar 9, 10:42 am, Michael Bayer [EMAIL PROTECTED] wrote:
 you can pull raw_connection() off of the engine.

 On Mar 9, 11:33 am, Greg Copeland [EMAIL PROTECTED] wrote:

  On Mar 8, 4:46 pm, Michael Bayer [EMAIL PROTECTED] wrote:

   we have a notion of how this feature can be implemented with oracle
   but the actual work has not been performed.

   i just put this notion into ticket #507 since I hadnt written it down
   anywhere.

   for now theres not really a good way to make it happen within SA's
   querying facilities; youd have to drop into cx_oracle to do it.

  Dang it.  I was afraid of that.  How do I grab the cx_Oracle cursor
  from SA?

  Thanks,

  Greg


--~--~-~--~~~---~--~~
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: SA support for SQLite ATTACH?

2007-03-09 Thread Karlo Lozovina

On Mar 9, 4:33 pm, Michael Bayer [EMAIL PROTECTED] wrote:

 attach database ...wow i never knew it had that !  if its a matter of
 issuing the string attach database, just use literal text() or
 engine.execute().

Me neither ;), until the other day I started looking for an efficient
way to dump in-memory SQLite databases to hdd. And this ATTACH thing
sounded just like made for it.

 attach databasevery handy !

So, let's say I issue this engine.execute(), how would one proceede
inserting rows into this attached database. Let's say mem_db is the
main, in-memory database, and file_db has just been attached, and is a
in-file database. SQL syntax is somewhat like this: INSERT INTO
file_db.table1 SELECT * FROM mem_db.table1, is any way SQLAlchemy can
do this without resorting to engine.execute() ?

Thanks!

Karlo.


--~--~-~--~~~---~--~~
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] Deep Eagerload

2007-03-09 Thread Dennis

I have a class that has a lazy loaded option.
This class is a parent of another table that I'd like to select from.

a-lazy_b

c-lazy_a

I want to eagerload both a  b like this:

c-a-b

Is there a way to specify that?

query(c).options(eagerload('a'),eagerload('a.b'))
seams logical.

Thoughts?

-Dennis


--~--~-~--~~~---~--~~
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: SA support for SQLite ATTACH?

2007-03-09 Thread Michael Bayer

OK, just read over ATTACH, you issue the ATTACH DATABASE command  
textually.  from that point on, the tables in that database are  
accessible using a schemaname syntax (i.e. schemaname.tablename).
if you really want to just copy tables wholesale, yeah youd have to  
issue INSERT ... SELECT statements which also would have to be  
texual at this point.  other operations can be done if you define  
Table objects with schema=whatever, and you can also use  
autoload=True to read them in for you.


On Mar 9, 2007, at 2:12 PM, Karlo Lozovina wrote:


 On Mar 9, 4:33 pm, Michael Bayer [EMAIL PROTECTED] wrote:

 attach database ...wow i never knew it had that !  if its a matter of
 issuing the string attach database, just use literal text() or
 engine.execute().

 Me neither ;), until the other day I started looking for an efficient
 way to dump in-memory SQLite databases to hdd. And this ATTACH thing
 sounded just like made for it.

 attach databasevery handy !

 So, let's say I issue this engine.execute(), how would one proceede
 inserting rows into this attached database. Let's say mem_db is the
 main, in-memory database, and file_db has just been attached, and is a
 in-file database. SQL syntax is somewhat like this: INSERT INTO
 file_db.table1 SELECT * FROM mem_db.table1, is any way SQLAlchemy can
 do this without resorting to engine.execute() ?

 Thanks!

 Karlo.


 


--~--~-~--~~~---~--~~
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: pyodbc and tables with triggers

2007-03-09 Thread Rick Morrison
This is still with pyodbc?  The MSSQL module should already set
sane_rowcount to False for that dialect, as per the pyodbc site, they don't
implement rowcount.

Rick


On 3/9/07, polaar [EMAIL PROTECTED] wrote:


 Hmmm, seems the set nocount on trick now causes problems on deletes:
 ConcurrentModificationError is thrown because Updated rowcount -1
 does not match number of objects updated 1.
 Which seems strange because I thought rowcount -1 simply meant that
 the count cannot be determined, not that there is something wrong.
 There seems to be a supports_sane_rowcount check (for MySQL according
 to the docs), wouldn't it make sense to treat a rowcount of -1 the
 same?
 Or should one just never use set nocount on when using the orm
 (which would mean back to the original problem)?

 Steven

 On Mar 7, 5:28 pm, polaar [EMAIL PROTECTED] wrote:
  On Mar 7, 3:29 pm, Tim Golden [EMAIL PROTECTED] wrote:
 
 
 
   code
   from sqlalchemy import *
   metadata = BoundMetaData (mssql://VODEV1/TimHolding)
   test = Table (test, metadata, autoload=True)
   result = test.insert ().execute (code = ABC)
   print result.last_inserted_ids ()
   # = [1]
   /code
 
   which is what I expected. If I explicitly set NOCOUNT OFF
   for my session (in case it's on by default) using:
 
  metadata.engine.raw_connection ().execute (SET NOCOUNT OFF)
 
   then it still works.
 
   Is my case the situation you're describing? Or have I
   misunderstood somthing?
 
  My fault: I forgot to tell you that I was using a mapped class, and
  it's the sqlalchemy-generated 'select @@identity' that causes the
  problem. (you can see that it does that in the log output)


 


--~--~-~--~~~---~--~~
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: Deep Eagerload

2007-03-09 Thread Michael Bayer

in theory youd say options(eagerload(a.b)).

the separate eagerload(a) isnt needed since its sort of impossible  
to eagerload b without eager loading a.


On Mar 9, 2007, at 3:01 PM, Dennis wrote:


 I have a class that has a lazy loaded option.
 This class is a parent of another table that I'd like to select from.

 a-lazy_b

 c-lazy_a

 I want to eagerload both a  b like this:

 c-a-b

 Is there a way to specify that?

 query(c).options(eagerload('a'),eagerload('a.b'))
 seams logical.

 Thoughts?

 -Dennis


 


--~--~-~--~~~---~--~~
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: Deep Eagerload

2007-03-09 Thread Dennis



On Mar 9, 2:20 pm, Michael Bayer [EMAIL PROTECTED] wrote:
 in theory youd say options(eagerload(a.b)).

 the separate eagerload(a) isnt needed since its sort of impossible
 to eagerload b without eager loading a.


But I'm assuming there isn't a way to do it currently.
I guess I could create a mapper for a that doesn't lazyload b and use
that mapper instead.

-Dennis


--~--~-~--~~~---~--~~
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: Deep Eagerload

2007-03-09 Thread Michael Bayer

except im totally wrong, at the moment you have to have the separate  
eagerload for each path, the way you have it.

On Mar 9, 2007, at 3:01 PM, Dennis wrote:


 I have a class that has a lazy loaded option.
 This class is a parent of another table that I'd like to select from.

 a-lazy_b

 c-lazy_a

 I want to eagerload both a  b like this:

 c-a-b

 Is there a way to specify that?

 query(c).options(eagerload('a'),eagerload('a.b'))
 seams logical.

 Thoughts?

 -Dennis


 


--~--~-~--~~~---~--~~
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: Deep Eagerload

2007-03-09 Thread Paul Johnston

Hi,

I guess I could create a mapper for a that doesn't lazyload b and use
that mapper instead.
  

I'm doing just that and it works fine for me.

Paul

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---