Re: [sqlalchemy] Re: How to query for something like this?

2015-09-22 Thread Johnny W. Santos
Anyway thanks, it'll help a lot.

-- 
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sqlalchemy+unsubscr...@googlegroups.com.
To post to this group, send email to sqlalchemy@googlegroups.com.
Visit this group at http://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.


Re: [sqlalchemy] Re: How to query for something like this?

2015-09-22 Thread Johnny W. Santos
Yes, but I think this will be expensive to arrange it with python because I
need to return everything at once.

I though I could just group_by with some annotation, but I couldn't figure
out how.

-- 
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sqlalchemy+unsubscr...@googlegroups.com.
To post to this group, send email to sqlalchemy@googlegroups.com.
Visit this group at http://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.


[sqlalchemy] How to query for something like this?

2015-09-22 Thread Johnny W. Santos
Supose I have the models below, how could I query for a result like this:

[
  {1: [{"id": 3, "location": "POINT(23.23423423 54.234524234)"},{"id": 4, 
"location": "POINT(23.23423423 54.234524234)"}]},
  {2: [{"id": 45, "location": "POINT(78.23423423 43.234524234)"},{"id": 67, 
"location": "POINT(34.2347683423 74.234524234)"}]},
]

The keys being the vehicle id and a list of HistoryPoints values.

Supposing I have more fields in HistoryPoint and is prefered to query on it 
due some filter conditions.


class Vehicle(Base):
id = Column(Integer, primary_key=True)
identifier = Column(Integer)


class HistoryPoint(Base):
vehicle_id = Column(Integer, FokeignKey('vehicles.id'))
location = Column(Geography('POINT'))

vehicle = relationship('Vehicle', backref='history')


I'm really having a hard time on this, any help will be appreciated 

Johnny

-- 
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sqlalchemy+unsubscr...@googlegroups.com.
To post to this group, send email to sqlalchemy@googlegroups.com.
Visit this group at http://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.


[sqlalchemy] There is any chance to SQLAlchemy works with syncio?

2015-09-16 Thread Johnny W. Santos
Hi guys,

I would like to know if theres is any chances to SQLAlchemy support asyncio 
out of the box? Like the ORM and such.

Thanks

Johnny

-- 
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sqlalchemy+unsubscr...@googlegroups.com.
To post to this group, send email to sqlalchemy@googlegroups.com.
Visit this group at http://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.


Re: [sqlalchemy] There is any chance to SQLAlchemy works with syncio?

2015-09-16 Thread Johnny W. Santos
Thanks for your lightning fast reply!

Actually my interest in asyncio is guided pretty much because I'm using
autobahn to do non-blocking websocket stuffs and and since it uses asyncio
I thought it would be seamless if I could use it to handle DB non-blocking
operations too.

I'll take a look at your blog post for a matter of clarification and try to
figure something out. Probably I'll show up here again soon.

Thanks


On Wed, Sep 16, 2015 at 11:37 AM, Mike Bayer <mike...@zzzcomputing.com>
wrote:

>
>
> On 9/16/15 10:17 AM, Johnny W. Santos wrote:
>
> Hi guys,
>
> I would like to know if theres is any chances to SQLAlchemy support
> asyncio out of the box? Like the ORM and such.
>
>
> Well the "real" answer is "yes", which is that you'd put your ORM business
> logic in a threadpool using
> https://docs.python.org/3/library/asyncio-eventloop.html#executor.   This
> will by far get you the best separation of asyncio's ORM-unfriendly
> concepts, the superior performance of traditional threads for that work,
> and the programming patterns that some people find important in asyncio on
> the outside of the traditional ORM-centric code.  For rationale on this
> as well as proof that asyncio's slowness and database awkwardness is
> entirely not worth it nor even appropriate, see
> http://techspot.zzzeek.org/2015/02/15/asynchronous-python-and-databases/.
>
> As far as an asyncio-explicit API for SQLAlchemy ORM, ORMs can't work very
> well with asyncio because they rely upon "lazy loading", which is a
> programming pattern directly in opposition to the philosophies of asyncio.
> That said, the Core can be made to work in an asyncio fashion but there's
> no roadmap for doing this extremely large amount of work (issue is at
> https://bitbucket.org/zzzeek/sqlalchemy/issues/3414/asyncio-and-sqlalchemy).
>
>
> There's also a project that re-implements very partial versions of parts
> of the Core to work on top of asynchronous psycopg2, that is
> https://github.com/aio-libs/aiopg.   Note however this project
> re-implements the execution internals completely so basic features like
> column defaults and datatypes won't really work as designed.
>
> IMO there *is* a technically appropriate and performant solution to your
> problem but it would require that you release any dogmatism you might have
> over the use of traditional threaded code within the context of explicit
> async code.
>
>
> Thanks
>
> Johnny
> --
> You received this message because you are subscribed to the Google Groups
> "sqlalchemy" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to sqlalchemy+unsubscr...@googlegroups.com.
> To post to this group, send email to sqlalchemy@googlegroups.com.
> Visit this group at http://groups.google.com/group/sqlalchemy.
> For more options, visit https://groups.google.com/d/optout.
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "sqlalchemy" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to sqlalchemy+unsubscr...@googlegroups.com.
> To post to this group, send email to sqlalchemy@googlegroups.com.
> Visit this group at http://groups.google.com/group/sqlalchemy.
> For more options, visit https://groups.google.com/d/optout.
>



-- 
Johnny W. dos Santos

-- 
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sqlalchemy+unsubscr...@googlegroups.com.
To post to this group, send email to sqlalchemy@googlegroups.com.
Visit this group at http://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.


[sqlalchemy] Auto generation of tables

2012-08-11 Thread Johnny Wezel
This could be sort of a FAQ. I skimmed this list but found nothing 
appropriate.

I'm looking for a way to auto-generate translation (in the i18n sense) 
tables for translatable columns to avoid writing the boilerplate, like in 
(as probably everybody would do):

class WhatNot(Base):
  ...

class Language(Base):
  ...

class WhatNot_I18N(Base):
  WhatNot_Id = Column(Integer, ForeignKey('WhatNot.Id'), primary_key=True)
  Language_Id = Column(Integer, ForeignKey('Language.Id'), primary_key=True)
  Description = Column(Unicode(128))
  OtherText = Column(Unicode(128))

So for every WhatNot there would be one or more WhatNot_I18N for the 
various translations of Description and OtherText.

I'm sure with SA there would be a way to automate creating such a 
translation table on the fly when defining the master table, either with 
@decorators, or like zzzeek's 
magichttp://techspot.zzzeek.org/2011/05/17/magic-a-new-orm. 
I've tried many ways, but to no success (well I've just started using it 
for a few days). Has anybody succeeded in doing such a thing, or what would 
be the best path towards it?

-- 
You received this message because you are subscribed to the Google Groups 
sqlalchemy group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/sqlalchemy/-/sSQaTyIbeikJ.
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] sqlalchemy introspection How?

2007-04-27 Thread johnny

I have tables created using another orm.  I just want to know, how I
can create sqlalchemy classes based on the tables, that are already
there in the database?

Thank you


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