[sqlalchemy] Dumping select data to SQL with relationships

2009-06-30 Thread Arthur Pemberton

Good day,

I'd like to know if there is a quick way to do the following:
 1) reflect an existing database (I know SA does this well)
 2) SELECT a few entries of a main table Foo, preserving all
relationships
 3) generate INSERT statements to create the selected Foo entries and
their relationships (in the same SQL dialect that they were read)

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



[sqlalchemy] Re: Any one tried to use SqlAlchemy with XML RPC?

2009-03-19 Thread Arthur Pemberton

On Thu, Mar 19, 2009 at 2:34 AM, Andreas Jung  wrote:
> -BEGIN PGP SIGNED MESSAGE-
> Hash: SHA1
>
> On 19.03.2009 8:32 Uhr, Arthur Pemberton wrote:
>> 2009/3/19 Andreas Jung :
>>> -BEGIN PGP SIGNED MESSAGE-
>>> Hash: SHA1
>>>
>>> On 19.03.2009 6:49 Uhr, Arthur Pemberton wrote:
>>>
>>>> SQLAlchemy needs a concept of Data Transfer Objects so that it can be
>>>> easily transmitted and reconstituted as necessary and everyone doesn't
>>>> have to reimplemented the idea themselves. There are many cases where
>>>> one might want to transfer a model from a data source on a server side
>>>> to a client, and vice verse.
>>> Which usecases? If you want to transfer objects over the wire from one
>>> app to another, you can also attach the database directly. You you work
>>> with serialized
>>> versions of the objects in some way...should be sufficient enough for most
>>> cases.
>>
>>
>> Any use case when the client doesn't have access to the database, but
>> the client app needs to manipulate the data of the model but not the
>> model itself.
>>
>> Client requests something
>> Server uses SQLAlchemy to query data
>> Server sends resulting entity collection to client via some form of RPC
>> Only the entity data is transmitted
>> Client makes modification, and wants to save the changes
>> Model, with changes is sent back to server
>> Server remaps it and saves it
>>
>> The client shouldn't be able to save the entity from their end. But
>> the developer shouldn't have to worry about making the entity lighter
>> every time as well.
>>
>
> As said: serialization is easy to implemented and JSON is your friend
> for transfering stuff over the net.

I didn't say that that wouldn't work. I said that that is a common
enough need that it should probably be fitted into SQLAlchmey so
everyone doesn't have to reinvent it, So that I can transfer my
entities in TwistedMatrix as easily as in XML-RPC or JSON-RPC


-- 
Fedora 9 : sulphur is good for the skin
( www.pembo13.com )

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



[sqlalchemy] Re: Any one tried to use SqlAlchemy with XML RPC?

2009-03-19 Thread Arthur Pemberton

2009/3/19 Andreas Jung :
> -BEGIN PGP SIGNED MESSAGE-
> Hash: SHA1
>
> On 19.03.2009 6:49 Uhr, Arthur Pemberton wrote:
>
>>
>> SQLAlchemy needs a concept of Data Transfer Objects so that it can be
>> easily transmitted and reconstituted as necessary and everyone doesn't
>> have to reimplemented the idea themselves. There are many cases where
>> one might want to transfer a model from a data source on a server side
>> to a client, and vice verse.
>
> Which usecases? If you want to transfer objects over the wire from one
> app to another, you can also attach the database directly. You you work
> with serialized
> versions of the objects in some way...should be sufficient enough for most
> cases.


Any use case when the client doesn't have access to the database, but
the client app needs to manipulate the data of the model but not the
model itself.

Client requests something
Server uses SQLAlchemy to query data
Server sends resulting entity collection to client via some form of RPC
Only the entity data is transmitted
Client makes modification, and wants to save the changes
Model, with changes is sent back to server
Server remaps it and saves it

The client shouldn't be able to save the entity from their end. But
the developer shouldn't have to worry about making the entity lighter
every time as well.

I made two attempts at a similar question myself:
http://www.mail-archive.com/sqlalchemy@googlegroups.com/msg10642.html
http://www.mail-archive.com/sqlalchemy@googlegroups.com/msg12582.html

-- 
Fedora 9 : sulphur is good for the skin
( www.pembo13.com )

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



[sqlalchemy] Re: Any one tried to use SqlAlchemy with XML RPC?

2009-03-18 Thread Arthur Pemberton

2009/3/19 Andreas Jung :
> -BEGIN PGP SIGNED MESSAGE-
> Hash: SHA1
>
> On 19.03.2009 5:24 Uhr, 一首诗 wrote:
>> This is my ORM class definition:
>>
>> #=
>> class User(Base):
>> __tablename__ = 'b_taa_user'
>>
>> user_id = Column(Integer, primary_key=True, autoincrement=True,
>> nullable=False) # 用户ID
>> user_name = Column(Unicode(255), unique=True, nullable=False,
>> server_default="") # 用户名称
>> user_password = Column(Unicode(255), nullable=False,
>> server_default="") # 用户密码
>> email = Column(Unicode(255), nullable=False, server_default="") # 邮
>> 箱
>> mobile = Column(Unicode(255), nullable=False, server_default="") #
>> 手机
>> phone = Column(Unicode(255), nullable=False, server_default="") # 电
>> 话
>>
>> def __init__(self, user_name = ""):
>> self.user_name = username
>> #=
>>
>> I made some debug by the code below:
>>
>> #=
>>
>> #!/usr/bin/python
>>
>> import xmlrpclib
>> from blf.model import User
>>
>> u = User('333')
>> s = xmlrpclib.dumps((u,), methodresponse=True, allow_none=True)
>> print s
>> #=
>>
>> Finally, I found that the first problem is :  xmlrpclib only serialize
>> type *instance*.
>> But to my surprise, when I check type of u, it's a *class* object.
>> Don't know why ...
>>
>>
>
> Sending mapped instances over XMLRPC is basically nonsense. XMLRPC is
> designed for transporting elementary datatypes over the wire in order to
> invoke a remote method. It is not designed for sending instances of some
> class and not for sending Python pickles. No idea what you are trying to
> accomplish. Consider converting a mapped instance to dict and sending
> this dict serialized in JSON format to a remote XMLRPC server.

SQLAlchemy needs a concept of Data Transfer Objects so that it can be
easily transmitted and reconstituted as necessary and everyone doesn't
have to reimplemented the idea themselves. There are many cases where
one might want to transfer a model from a data source on a server side
to a client, and vice verse.


-- 
Fedora 9 : sulphur is good for the skin
( www.pembo13.com )

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



[sqlalchemy] Transparent Web Service with SqlAlchmey?

2008-12-24 Thread Arthur Pemberton

My googling hasn't yet been fruitful

Are there any existing solutions which would essentially allow me to
build a web service which can be consumed by a 'client side' python
app which would serve SqlAlchmey models transparently such that data
would be be retrieved from the web service end, manipulated on the
client end and saved transparently to the web service end?

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



[sqlalchemy] Best way to populate with data?

2008-09-29 Thread Arthur Pemberton

What is the best way to populate an app with data, for base data and
test data purposes?

Is there an easy way to maintain some XML files with the base and
tests data? or is it the best way to just have a python script with
the data hard coded into it?

-- 
Fedora 9 : sulphur is good for the skin
( www.pembo13.com )

--~--~-~--~~~---~--~~
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] DTOs and RPC

2008-08-27 Thread Arthur Pemberton

I am looking into what are the best practices, common methods of doing
things like RPC with SqlAlchemy declarative_base sublcasses.

Is there a concept of DTO? Or is this something I would have to build
into it myself?

Thank you.

-- 
Fedora 7 : sipping some of that moonshine
( www.pembo13.com )

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