[sqlalchemy] Re: Asynchronous SQLAlchemy--Anybody using Twisted, sAsync?

2007-02-24 Thread Manlio Perillo

Allen Bierbaum ha scritto:
 On 2/21/07, Manlio Perillo [EMAIL PROTECTED] wrote:
 Matt Culbreth ha scritto:
 Howdy Group,

 I'm playing out with a few things now and I wanted to see if anyone
 else has used SQLAlchemy in an asynchronous manner?  For example, you
 could create a service which responded to asynchronous requests for
 data, and could be used by a web client, desktop client, other types
 of clients, etc.

 I'm using SQLAlchemy with Twisted, but I have implemented a custom wrapper:
 https://developer.berlios.de/projects/nadbapi/

 The main feature is a better integration with SQLALchemy (the Engine
 class implements the Connectable interface).

 The version on berlios.de is a bit old, I have made some changes.
 
 Is the latest version available from revision control anywhere public?
 

No, sorry.
I'm using nadbapi in an important project, so I want to be sure to have 
a stable version before moving the repository to a public server.



Regards  Manlio Perillo

--~--~-~--~~~---~--~~
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: Tool to autogenerate code from db schema

2007-02-24 Thread Paul Johnston

Hi,

Well, I had a little go at this, see 
http://www.sqlalchemy.org/trac/wiki/UsageRecipes/AutoCode

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



[sqlalchemy] Re: how to force a clean refresh of a lazy loaded attribute

2007-02-24 Thread Michael Bayer


On Feb 23, 2007, at 1:56 PM, Manlio Perillo wrote:


 Hi again.

 I have an object attribute loaded via lazy loader.
 This object is loaded in a transaction.

 Then, in another transaction, I ussue an update statement (via the sql
 module, not using the orm), that updates the table of the main  
 object's
 attribute.

 The problem, now, is that I want to reload this attribute.

 I have tried, in a separate transaction:
 sess.update(obj)
 sess.expire(obj)

 One problem here is that the entire object is reloaded, and I do not
 want this.

i think if you say delattr(obj, attributename), it will do a lazyload  
on the next run.


 The other problem (maybe a bug?) is that the orm issue another  
 query to
 reload the data from the database, but in the object I still find the
 old values!

 I have submitted a ticket for the last problem (#492).

refresh-expire cascade had not yet been implemented, just added it  
in the trunk.



--~--~-~--~~~---~--~~
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 get column names in result

2007-02-24 Thread vkuznet

Hi,
a very simple question which I cannot find in documentation. How to
get column names together with result. This is useful for web
presentation of results using templates. I used use_labels=True,
indeed it construct query with names, but my final result contains
only column values. What I wanted is to get
as a first row the column names.

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: select ... having problems

2007-02-24 Thread Jonathan Ellis

Something like this should work:

select(['count(distinct flow.node_id) as nodes', ip],
from_obj=[flow.join(id)], group_by=[flow.c.src_id], having=['nodes 
5'], order_by=[desc('nodes')])

If you wanted to do it w/o text blocks I think you'd have to create a
subselect first to pull the nodes column off of.

On 2/23/07, Arthur Clune [EMAIL PROTECTED] wrote:


 This should be easy, but I'm having real problems with it. I'd like
 to do the following SQL (this is from MySQL) as a sqa query:

 select count(distinct flow.node_id) as nodes, ip.ip_addr,
 ip.country, ip.domain, ip.isp, ip.city from flow, ip where flow.src_id =
 ip.id group by flow.src_id having nodes  5 order by nodes desc;

 I can't work out how to do the 'having nodes  5' bit at all. All
 help gratefully received!

 For info, the tables look like this (with some fields missed out for
 clarity):

 Tables are pretty straightfoward. Slighty edited, they look like this:

 owner_table = Table(node,
  Column(id, Integer, primary_key=True),
 [more stuff]
 )

 # location data based on the fields from ip2location
 ip_table = Table(ip,
  Column('id', Integer, primary_key=True),
  Column('ip_addr', String(16), nullable=False, index=True,
 unique=True),
  Column('isp', Unicode, default=0.0),
  Column('domain', Unicode, default=0.0),
  Column('country', Unicode, default=None),
  Column('city', Unicode, default=None),
 )

 flow_table = Table(flow,
  Column(id, Integer, primary_key=True),
  Column(owner_id, Integer, ForeignKey(honeypot.id),
  nullable=False),
  Column(ip_proto, Integer, default=6, nullable=False),
  Column(src_id, Integer, ForeignKey(ip.id), nullable=False),
  Column(dst_id, Integer, ForeignKey(ip.id), nullable=False),
 )

 Then I define the obvious mappers.

 Cheers,

 Arthur

 --
 Arthur Clune





 


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