List:NDB Connectors« Previous MessageNext Message »
From:Monty Taylor Date:March 27 2007 12:24am
Subject:SQLAlchemy
View as plain text  
I submitted a patch to sqlalchemy this morning today which Michael Bayer
is going to apply that allows us to write a sqlalchemy engine and
distribute it as a plugin using Entry Points. So, with that done (or
close to done at least) I added my sqlalchemy code to the ndb-connectors
mainline and pushed it this morning as well. The file is in
python/mysql/cluster/alchemy.py

It means that for now you'll have to follow sqlalchemy SVN if you want
to be able to work with writing the sqlalchemy dialect, but the fix
should be in the next release, whenever that happens. Ah, the joy of
development.

So what's in there _sort_ of works, except it has to commit in the
pre_exec phase (there is a place where the visitor code stringifies
query objects, and we do not have a string representation). So what we
need to do is create a new EngineStrategy and a new Engine or Executor.
Check out Michael's response to me in this post:

http://groups.google.com/group/sqlalchemy/browse_thread/thread/1605eb10941ce565/ea73d9b2aa887534?lnk=gst&q=ndbapi&rnum=1#ea73d9b2aa887534

There is a test program - testsqlalchemy.py  - that shows usage of
inserting a record.

As a note - it may look like it doesn't work if you get it to run
because of the rollback at the end. Check the db. It adds records. Woot.

The really cool part is how efficient this could eventually be. If you
look at the output of the unitofwork logger, or just at the code in
unitofwork.py in SA, you'll see that SA builds a dependency graph of all
the objects that need to change and then does them all in one fell
swoop. SA already knows all the meta-info it needs to, so there's some
good optimization that can happen, and most of the transactions should
be able to batch multiple operations per transaction - which it can't do
as well logically going through SQL first.

Anyway, I know I said I was going to port the junit stuff to Python -
but I thought I'd get this stuff committed so other people could hack, too.


Monty


Matthew Russell wrote:
> Hi Monty,
> 
> I don't know you, and have not conversed with you on any previous occassion.
> 
> I'm a software developer with about nine years experience, primarily
> using Python, although I am also compotent in C and Java.
> 
> I am interested in the NDBConnecters project from a technical
> perspective; my company is currently looking to utilise MySQL cluster in
> our application.
> We are a payment service provider, brokering real time transactions,
> primarily to UK acquirers, requiring 5 9's availablity, and as such fall
> into the target audience for the MySQL cluster solution.
> 
> Until I discovered this project, and your notes from MySQL camp 2006, I
> had been
> evisoning using SQLAlchemy as a possible solution for client SQL access
> to the cluster.
> I notice that the NdbObject python code you posted to your blog uses
> SQLObject,
> and am considering an implementation using SQLAlchemy - I am interested
> developing SA support to the NdbObject API (I assume NdbObject is part
> of the Connectors project?). 
> Whilst I am not a developer on the SQLAlchemy project, I believe I
> understand enough of the API in order to make an attempt.
> 
> If I can do anything to help to speed the developement of the
> NDBConnection project,
> I'd be only glad to.  I will work through the mailing list as you suggest.
> Thanks,
> Matt
> 
> On 24/03/07, *Monty Taylor* <mtaylor@stripped
> <mailto:mtaylor@stripped>> wrote:
> 
>     Hi Matt,
> 
>     I'm thrilled that you'd like to help out with the NDB Connectors
>     project. I'm not placing you in my head, though. Since team membership
>     equates to check-in privileges, why don't we start you off working
>     through the mailing list (ndb-connectors@stripped
>     <mailto:ndb-connectors@stripped>). If you get a
>     branch of the code and make changes, you can email me the output of bzr
>     bundle-revisions which I can look over and apply. I'm pretty easy
>     going,
>     so if we do that a few times and things are going well, I'll be happy to
>     add you to the team and let you push directly.
> 
>     Unless, of course, I already know you and your work and I'm just not
>     placing it because it's early in the morning. :)
> 
>     Do you have any specific development interest regarding the NDB
>     Connectors?
>     --
>     Monty Taylor
>     Senior Consultant
>     MySQL Inc., www.mysql.com <http://www.mysql.com>
>     Get More with MySQL!   www.mysql.com/consulting
>     <http://www.mysql.com/consulting>
> 
> 
> 
> 
> -- 
> Cheers,
> Matt


-- 
Monty Taylor
Senior Consultant
MySQL Inc., www.mysql.com
Get More with MySQL!  www.mysql.com/consulting
Thread
SQLAlchemyMonty Taylor27 Mar