Re: [sqlalchemy] custom queries

2016-01-14 Thread Richard Gerd Kuesters
ng the end-user statement as I illustrated is already available now. as On 01/13/2016 01:46 PM, Richard Gerd Kuesters wrote: yup! i already was going this way. it would be impossible to "automagically" do this without the performance sacrifice ... lol. well, if this looks reasonable in

Re: [sqlalchemy] custom queries

2016-01-13 Thread Richard Gerd Kuesters
ls, though you'd need to step through things to see the full chain. A tool like RunSnakeRun can provide a graphical display instead. On 01/13/2016 11:58 AM, Richard Gerd Kuesters wrote: hi all! i'm wondering if there's a way to determinate if a query was "launch" by my code (ex.

Re: [sqlalchemy] custom queries

2016-01-13 Thread Richard Gerd Kuesters
ython statement. You could do this inside the before_execute() event, for example. On 01/13/2016 01:31 PM, Richard Gerd Kuesters wrote: Mike, thanks for your attention and i'm sorry, i was not clear enough in my question. i would like to know if there's a way to tell if a query was fired by

[sqlalchemy] custom queries

2016-01-13 Thread Richard Gerd Kuesters
hi all! i'm wondering if there's a way to determinate if a query was "launch" by my code (ex. session.query(Entity)...) or by the internals of sqlalchemy (backref, relationship, etc). i think it's better to use a example, based on *adjacency_list.py*: http://pastebin.com/q3yx36vn in the

[sqlalchemy] pgsql + jsonb + orm update = possible bug?

2015-10-09 Thread Richard Gerd Kuesters
Hello! I was working with a JSONB column in postgres and I noticed that no updates were issued when changing some inside value, so I have to issue "*flag_modified*" everytime I change my JSONB attribute. Here's a sample code that shows this: # -*- coding: utf-8 -*- from __future__

Re: [sqlalchemy] pgsql + jsonb + orm update = possible bug?

2015-10-09 Thread Richard Gerd Kuesters
thanks Mike! I'm glad I used a "?" in the subject :) I was thinking that something may be missing, so there it is ... cheers, richard. On 10/09/2015 10:11 AM, Mike Bayer wrote: I see no usage of Mutable, which is required if you want to detect updates within a JSON value. -- You received

Re: [sqlalchemy] one-to-one: lost on track

2015-10-01 Thread Richard Gerd Kuesters
ok, just for the record, my "lazyness" lead me to use `lazy='joined'` in a backref and now things works fine :) richard. On 10/01/2015 09:03 AM, Richard Gerd Kuesters wrote: hey all! i think i got lost on track about relationships, specially one-to-one. i'll not go into (cod

[sqlalchemy] one-to-one: lost on track

2015-10-01 Thread Richard Gerd Kuesters
hey all! i think i got lost on track about relationships, specially one-to-one. i'll not go into (code) details because all my one-to-one are failing with the following exception: * * *python2.7/site-packages/sqlalchemy/orm/query.pyc in _no_criterion_assertion(self, meth, order_by,

Re: [sqlalchemy] Question about FAQ entry titled "I’m getting a warning or error about “Implicitly combining column X under attribute Y”"

2015-09-08 Thread Richard Gerd Kuesters
is your "A" class abstract and/or are you using them with polymorphism? regards, richard. On 09/08/2015 07:00 AM, Piotr Dobrogost wrote: Hi! In the FAQ there's entry titled "I’m getting a warning or error about “Implicitly combining column X under attribute Y”" with the following example:

Re: [sqlalchemy] Question about FAQ entry titled "I’m getting a warning or error about “Implicitly combining column X under attribute Y”"

2015-09-08 Thread Richard Gerd Kuesters
well, i'm sorry if i'm pouring could water on you but continuum never worked as expected (at least for me) and i always used history_meta for audit, which comes packaged with sqlalchemy as an example and is much more friendly if you need to add functionalities on your own :) cheers, richard.

Re: [sqlalchemy] What about bit fields / bit masks?

2015-08-29 Thread Richard Gerd Kuesters
IMHO, it is better to use ints for masks because they can be indexed by the database. AFAIK, bits can't be indexed and any bit operator in a query (let's say, WHERE mybit MYMASK) would probably result in a full table scan. well, it's just my two cents from an info I got a long time ago. I

[sqlalchemy] polymorphic_identity as an expression

2015-08-20 Thread Richard Gerd Kuesters
hello! is it possible to set the polymorphic_identity mapper param as an expression? example: __mapper_args__ = { polymorphic_identity: in_('employee', 'recruit') } thanks a lot, richard. -- You received this message because you are subscribed to the Google Groups

Re: [sqlalchemy] polymorphic_identity as an expression

2015-08-20 Thread Richard Gerd Kuesters
Gerd Kuesters wrote: hello! is it possible to set the polymorphic_identity mapper param as an expression? example: __mapper_args__ = { polymorphic_identity: in_('employee', 'recruit') } thanks a lot, richard. -- You received this message because you are subscribed

Re: [sqlalchemy] loops and session

2015-08-06 Thread Richard Gerd Kuesters
defer anywhere). can some of that cause any interference that can cause this behaviour? On 08/06/2015 03:29 PM, Mike Bayer wrote: On 8/6/15 1:50 PM, Richard Gerd Kuesters wrote: well, i ran today into an issue i never seen before. considering this simple example: session = get_session

[sqlalchemy] loops and session

2015-08-06 Thread Richard Gerd Kuesters
well, i ran today into an issue i never seen before. considering this simple example: session = get_session() objs = [] for ign in xrange(10): o = NewObject() objs.append(o) session.add_all(objs) session.commit() for obj in objs: print obj in session

Re: [sqlalchemy] loops and session

2015-08-06 Thread Richard Gerd Kuesters
/6/15 3:03 PM, Richard Gerd Kuesters wrote: thanks Mike! ok, going further then: 1. i'm using postgres (isolation_level=REPEATABLE READ); 2. it's inside a twisted app, into a defer, _but_ the session lifecycle starts and ends in that defer; 3. in that same (python) process, there's a txpostgres

Re: [sqlalchemy] set vs after_flush events

2015-07-24 Thread Richard Gerd Kuesters
will this answer my second question? obj._sa_instance_state.committed_state {'batch_status': STARTED(db=1), 'updated_by': 24769797950537744L, 'updated_on': Arrow [2015-07-24T14:02:03.360479-03:00]} cheers, richard. On 07/24/2015 11:13 AM, Richard Gerd Kuesters wrote: hi! first, /yes/, set

Re: [sqlalchemy] set vs after_flush events

2015-07-24 Thread Richard Gerd Kuesters
On 07/24/2015 12:59 PM, Mike Bayer wrote: On 7/24/15 10:13 AM, Richard Gerd Kuesters wrote: hi! first, /yes/, set and after_flush are quite different events :) but here's what i'm trying to accomplish: one object have an attribute, like 'state', and i would like to monitor and trigger

Re: [sqlalchemy] set vs after_flush events

2015-07-24 Thread Richard Gerd Kuesters
obj._sa_instance_state.committed_state.get('key') == obj._sa_instance_state.dict.get('key') False is this all that's necessary to track down what's modified and the past state (i believe to be sa_instance_state.dict) ? cheers, richard. On 07/24/2015 11:34 AM, Richard Gerd Kuesters wrote

Re: [sqlalchemy] Re: set vs after_flush events

2015-07-24 Thread Richard Gerd Kuesters
well, as a general non-specific view yes, it can be another approach. but, for the piece of code that drove me to this question, i really need to use after_flush :) cheers, richard. On 07/24/2015 02:15 PM, Jonathan Vanasco wrote: Couldn't you handle much of this with the Descriptors/Hybrids

Re: [sqlalchemy] Re: set vs after_flush events

2015-07-24 Thread Richard Gerd Kuesters
well, application-wise it is really to run other procedures, not from the database or python side, but from a message broker that's expecting anything to happen to that value -- even if it's just a touch :) err ... it's quite a specific architecture for dumb clients, so i'm just taking some

Re: [sqlalchemy] set vs after_flush events

2015-07-24 Thread Richard Gerd Kuesters
yes, a public api would be awesome, perhaps for a future version? :) for now, i'll stick to that -- since it works, heh. cheers, richard. On 07/24/2015 12:59 PM, Mike Bayer wrote: On 7/24/15 10:45 AM, Richard Gerd Kuesters wrote: obj._sa_instance_state.committed_state.get('key') == obj

[sqlalchemy] set vs after_flush events

2015-07-24 Thread Richard Gerd Kuesters
hi! first, /yes/, set and after_flush are quite different events :) but here's what i'm trying to accomplish: one object have an attribute, like 'state', and i would like to monitor and trigger some other methods if (given scenarios): 1. the program sets a new value to a state that is

Re: [sqlalchemy] Re: set vs after_flush events

2015-07-24 Thread Richard Gerd Kuesters
yeah, that's basically what i'm doing: gathering information about what's happening and sending a response as quick as i can, since most of the clients are step machines (they still exists), so ... :) On 07/24/2015 04:01 PM, Jonathan Vanasco wrote: On Friday, July 24, 2015 at 2:06:15 PM

Re: [sqlalchemy] best books on DB design for sqlalchemy users?

2015-07-23 Thread Richard Gerd Kuesters
not quite sqlalchemy related, but one of the best readings i've had about sql was SQL Anti-Patterns: https://pragprog.com/book/bksqla/sql-antipatterns it is not about how to do sql right, it's about not to do certain types of sql, lol. On 07/23/2015 01:35 PM, Rich Shepard wrote: On Thu,

Re: [sqlalchemy] strange behavior in count with custom mapper option

2015-07-16 Thread Richard Gerd Kuesters
of 2, .all() gives you one object. On 7/15/15 3:58 PM, Richard Gerd Kuesters wrote: right! sorry, now here we go (again): (Pdb) import logging (Pdb) logging.basicConfig() (Pdb) logging.getLogger('sqlalchemy.engine').setLevel(logging.DEBUG) (Pdb) session.query(MachineUnit

[sqlalchemy] strange behavior in count with custom mapper option

2015-07-15 Thread Richard Gerd Kuesters
hello! i'm encountering a weird behaviur with session.count() when using a custom mapper that implements a where condition to every session. first, what is happening: len(session.query(Entity).all()) == 1 session.query(Entity).count() == 2 Entity is a base polymorphic entity, inherited by

Re: [sqlalchemy] strange behavior in count with custom mapper option

2015-07-15 Thread Richard Gerd Kuesters
oh, forgot to mention: * this occurs even with a filter that's supposed to bring one register only (at the database level it works); * in the database level, a count *without* the where clause brings the result i mentioned earlier. thanks, richard. On 07/15/2015 03:11 PM, Richard Gerd

Re: [sqlalchemy] strange behavior in count with custom mapper option

2015-07-15 Thread Richard Gerd Kuesters
=# select count(*) from entity where id_ = 24769797950537768; count --- 1 (1 row) is this really right? On 07/15/2015 04:02 PM, Mike Bayer wrote: On 7/15/15 2:11 PM, Richard Gerd Kuesters wrote: hello! i'm encountering a weird behaviur with session.count() when using a custom mapper

Re: [sqlalchemy] strange behavior in count with custom mapper option

2015-07-15 Thread Richard Gerd Kuesters
to the faq entry you mentioned earlier? :) cheers, richard. On 07/15/2015 04:22 PM, Mike Bayer wrote: On 7/15/15 3:13 PM, Richard Gerd Kuesters wrote: does this happen even with a filter for a PK? the problem is: session.query(Entity).filter(Entity.id_ == 24769797950537768).count() == 2 len

Re: [sqlalchemy] strange behavior in count with custom mapper option

2015-07-15 Thread Richard Gerd Kuesters
oh, the pk 24769797950537768 is a postgres biginteger. On 07/15/2015 04:46 PM, Richard Gerd Kuesters wrote: thanks Mike! here we go: (Pdb) session.query(MachineUnit).filter(MachineUnit.id_ == 24769797950537768).count() 2015-07-15 16:43:53,114 INFO sqlalchemy.engine.base.Engine

Re: [sqlalchemy] strange behavior in count with custom mapper option

2015-07-15 Thread Richard Gerd Kuesters
: On 7/15/15 3:46 PM, Richard Gerd Kuesters wrote: thanks Mike! here we go: (Pdb) session.query(MachineUnit).filter(MachineUnit.id_ == 24769797950537768).count() 2015-07-15 16:43:53,114 INFO sqlalchemy.engine.base.Engine SELECT count(*) AS count_1 FROM system_unit, (SELECT

Re: [sqlalchemy] strange behavior in count with custom mapper option

2015-07-15 Thread Richard Gerd Kuesters
pollux(# FROM system_unit JOIN machine_unit ON system_unit.pk_system_unit_id = machine_unit.pk_fk_system_unit_id pollux(# WHERE machine_unit.pk_fk_system_unit_id = 24769797950537768) AS anon_1; count_1 - 2 (1 row) faq? :) On 07/15/2015 04:58 PM, Richard Gerd

[sqlalchemy] is it two or more levels of polymorphism possible?

2015-07-15 Thread Richard Gerd Kuesters
hi all, i was wondering if there's a way to create more than one level of polymorphic entities in sa. quick example: class Foo(Base): ... __mapper_args__ = { ... } class Bar(Foo): ... __mapper_args__ = { ??? } # --- polymorphic_identity for ... two?

Re: [sqlalchemy] is it two or more levels of polymorphism possible?

2015-07-15 Thread Richard Gerd Kuesters
/15/15 9:09 AM, Richard Gerd Kuesters wrote: hi all, i was wondering if there's a way to create more than one level of polymorphic entities in sa. quick example: class Foo(Base): ... __mapper_args__ = { ... } class Bar(Foo): ... __mapper_args__

Re: [sqlalchemy] How to do a revision table or How to get a 1:1 and 1:n relationship between the same tables to work properly

2015-06-18 Thread Richard Gerd Kuesters
have you taken a look at this approach? https://bitbucket.org/zzzeek/sqlalchemy/src/4a25c10e27147917e93e6893df13b2b55673e0a7/examples/versioned_history/?at=master chers, richard. On 06/18/2015 08:44 AM, Adrian wrote: I hadn't seen that part of the documentation - doing it that way works fine

[sqlalchemy] get referencing foreign table + column

2015-06-18 Thread Richard Gerd Kuesters
hello all! i think this is a quick question: is there a way to get the referencing table and column from a given foreign key column, rather then list(col.impl.parent_token.expression.foreign_keys)[0] ? best regards, richard. -- You received this message because you are subscribed to the

Re: [sqlalchemy] creating indexes from inherited fields

2015-06-02 Thread Richard Gerd Kuesters
thanks a lot, Mike! good catch of yours. the answer was in front of me all the time and i couldn't see it ... my mistake, thanks for pointing the right direction ;) best regards, richard. On 06/02/2015 03:17 PM, Mike Bayer wrote: On 6/2/15 12:59 PM, Richard Gerd Kuesters wrote: thanks

[sqlalchemy] creating indexes from inherited fields

2015-06-02 Thread Richard Gerd Kuesters
hi all, again :) how can I create an index in fields inherited by other classes? example: class TimestampMixin(object): updated_on = Column(DateTime) # i wanted to create three indexes in this field, updated_on, updated_on.asc() and updated_on.desc() class SomeOtherClass(Base,

Re: [sqlalchemy] creating indexes from inherited fields

2015-06-02 Thread Richard Gerd Kuesters
Bayer wrote: On 6/2/15 10:16 AM, Richard Gerd Kuesters wrote: hi all, again :) how can I create an index in fields inherited by other classes? example: class TimestampMixin(object): updated_on = Column(DateTime) # i wanted to create three indexes in this field, updated_on, updated_on.asc

Re: [sqlalchemy] creating indexes from inherited fields

2015-06-02 Thread Richard Gerd Kuesters
be associated with table 'http_adapter'. in the example above, http_error inherits from adapter. best regards, richard. On 06/02/2015 01:45 PM, Mike Bayer wrote: On 6/2/15 12:05 PM, Richard Gerd Kuesters wrote: oh, sorry Mike, I forgot to mention that I use TimestampMixin in other classes

[sqlalchemy] how to return an array of dicts

2015-06-01 Thread Richard Gerd Kuesters
hello all! probably this was asked before, as I already grabbed some answers already from here and stackoverflow, but I don't really feel happy about it. problem: i have a query that it's result must go directly as a json (web / rpc usage), and I wonder if I must go from the cycle . class

Re: [sqlalchemy] how to return an array of dicts

2015-06-01 Thread Richard Gerd Kuesters
straight, performance-wize optimization :) best regards, richard. On 06/01/2015 10:00 AM, Simon King wrote: On Mon, Jun 1, 2015 at 1:51 PM, Richard Gerd Kuesters rich...@pollux.com.br wrote: hello all! probably this was asked before, as I already grabbed some answers already from here

Re: [sqlalchemy] how to return an array of dicts

2015-06-01 Thread Richard Gerd Kuesters
Thanks Jonathan, I agree with you, 100%. I have methods for that also, when I have to deal with the real objects and queries and stuff. The point, in my question, is that I have some services that are not vital to my application, but are used constantly -- and it just spits out data. I'm

Re: [sqlalchemy] how to return an array of dicts

2015-06-01 Thread Richard Gerd Kuesters
argh! results = map(lambda r: dict(r.items()), session.execute(my_select).fetchall()) much simplier :) but, the question persists: is this the best approach for a raw data dictionary result query? best regards, richard. On 06/01/2015 10:22 AM, Richard Gerd Kuesters wrote: well, i can

Re: [sqlalchemy] how to return an array of dicts

2015-06-01 Thread Richard Gerd Kuesters
thoughts? :) On 06/01/2015 10:08 AM, Richard Gerd Kuesters wrote: thanks Simon! yes, i'm already using hooks so I can pass datetime, decimal, enums and so on; of course, it can help if I have to go with the result proxy. i just wonder if there's another way of doing this without having

Re: [sqlalchemy] restrict child count?

2015-05-19 Thread Richard Gerd Kuesters
not a problem -- i'll have to managed something by myself :) ps: sorry for my bad english, sometimes i can't make understandable questions :) best regards, richard. On 05/19/2015 11:16 AM, Mike Bayer wrote: On 5/19/15 8:57 AM, Richard Gerd Kuesters wrote: hi! this may be a weird question

Re: [sqlalchemy] restrict child count?

2015-05-19 Thread Richard Gerd Kuesters
Gerd Kuesters wrote: thanks Mike! when i stated about the limit, it was because it must not be taken as a parameter for any query, which select * from blah and select * from bla limit N should be return the same exactly number of rows, including where filters and so on. it is something like

[sqlalchemy] restrict child count?

2015-05-19 Thread Richard Gerd Kuesters
hi! this may be a weird question, but is there a way i can restrict the number of children in a relationship? not by limit ... scenario: i have a one to many rel, where the parent have 3 values (row, column, depth) that creates a max child count of row * column * depth (yes, like the 3d

Re: [sqlalchemy] Re: restrict child count?

2015-05-19 Thread Richard Gerd Kuesters
i know, i'm sorry for that. i first posted it here since my whole application is managed by sqlalchemy, so that's why i asked for something. i mentioned postgresql because it's the database that i use and there's a lot of database specific solutions bundled with sa. but, even if no rdbms

Re: [sqlalchemy] polymorphic objects

2015-04-28 Thread Richard Gerd Kuesters
://pypi.python.org/pypi/sqla-hierarchy)). when it comes to polymorphism, i forgot that i had to use select instead of query to retrieve my objects :) best regards, richard. On 04/27/2015 07:41 PM, Mike Bayer wrote: On 4/27/15 4:31 PM, Richard Gerd Kuesters wrote: well, i'm having trouble dealing

[sqlalchemy] polymorphic objects

2015-04-27 Thread Richard Gerd Kuesters
well, i'm having trouble dealing with polymorphic objects. i mean, the functionality is fine, i just don't know how to obtain the main object. let me be clear: i have A, which is my main object, and is inherited by B and C. I would like to work with the A object, even though it's polymorphic

Re: [sqlalchemy] Making a new type out of Postgres DATERANGE + Psycopg2 DateRange

2015-04-24 Thread Richard Gerd Kuesters
perhaps this could help you? http://sqlalchemy-utils.readthedocs.org/en/latest/range_data_types.html#datetimerangetype richard. On 04/24/2015 10:09 AM, Dimitris Theodorou wrote: Hi, I am using psycopg2 and trying to put together a new daterange type that combines the following: 1. A

Re: [sqlalchemy] SQLAlchemy as plain-SQL generator

2015-04-22 Thread Richard Gerd Kuesters
well, i know that repeating (query) is somehow strange, i believe the main reason is that *compile()**.process*are not bound to the query anymore (*i might be wrong*). well, for me it was a one time solution, perhaps a little digging can bring you a better approach :) cheers, richard. On

Re: [sqlalchemy] SQLAlchemy as plain-SQL generator

2015-04-22 Thread Richard Gerd Kuesters
yeah, well, that's much simpler. in my scenario, where i had to use this piece of code, literal_binds are necessary since the query is somehow huge, with lots of alias and parameters :) On 04/22/2015 11:07 AM, Mike Bayer wrote: On 4/22/15 8:27 AM, Richard Gerd Kuesters wrote: hi, you

Re: [sqlalchemy] SQLAlchemy as plain-SQL generator

2015-04-22 Thread Richard Gerd Kuesters
hi, you must use a specific dialect so sqlalchemy can create it for you. not the best usage, imho, but here it goes: *stmt = query.compile().process(query, literal_binds=True)* i don't know if you want it formated or what, if so, *sqlparse*provides a good way to do it. but, again, this

Re: [sqlalchemy] polymorphic inheritance and unique constraints

2015-04-15 Thread Richard Gerd Kuesters
expression). of course, the approach does require an extra table, but with events I can easily make it work in sqlalchemy. cheers, richard. On 04/14/2015 08:40 AM, Richard Gerd Kuesters | Pollux Automation wrote: here, a better illustration with my actual code: http://pastebin.com/RxS8Lzft

Re: [sqlalchemy] polymorphic inheritance and unique constraints

2015-04-15 Thread Richard Gerd Kuesters
nevermind. i'm again victim of rtfm :) http://docs.sqlalchemy.org/en/latest/dialects/postgresql.html#postgresql-table-options great work on this, btw. it'll simplify my life *A LOT* :) best regards, richard. On 04/15/2015 10:10 AM, Richard Gerd Kuesters wrote: hello Mike! so ... ok, based

Re: [sqlalchemy] polymorphic inheritance and unique constraints

2015-04-15 Thread Richard Gerd Kuesters
), right? On 04/15/2015 02:55 PM, Richard Gerd Kuesters wrote: the table definitions are listed here: http://pastebin.com/RxS8Lzft i'm using polymorphic associations, but with inheritance (INHERITS) there's no need to do it (imho), so the fk column to the parent table (which is also the pk) can

Re: [sqlalchemy] polymorphic inheritance and unique constraints

2015-04-15 Thread Richard Gerd Kuesters
*, exception. ps: using ConcreteBase, the error is: AttributeError: type object 'ContainerInstance' has no attribute '__mapper__' On 04/15/2015 03:13 PM, Richard Gerd Kuesters wrote: oh, right, concrete! abstract concrete can also do the trick? On 04/15/2015 03:10 PM, Mike Bayer wrote: On 4

Re: [sqlalchemy] polymorphic inheritance and unique constraints

2015-04-15 Thread Richard Gerd Kuesters
oh, right, concrete! abstract concrete can also do the trick? On 04/15/2015 03:10 PM, Mike Bayer wrote: On 4/15/15 1:59 PM, Richard Gerd Kuesters wrote: oops, i forgot to comment out the fk to the parent table and now it doesn't work: sqlalchemy.exc.NoForeignKeysError: Can't find any

Re: [sqlalchemy] polymorphic inheritance and unique constraints

2015-04-15 Thread Richard Gerd Kuesters
didn't know of such a feature ... thanks for bring it on :) although, is there a way to use it in declarative, intead of: MyModel.__table__.add_is_dependent_on(MyParentModel.__table__) ? cheers, richard. On 04/15/2015 02:44 PM, Mike Bayer wrote: On 4/15/15 1:07 PM, Richard Gerd Kuesters

Re: [sqlalchemy] polymorphic inheritance and unique constraints

2015-04-15 Thread Richard Gerd Kuesters
yup, i know (this pattern) it is not ideal; i was just testing the new features of sa 1.0 regarding postgres (since i'm actually hands-on). i should rewrite a whole part of my model (and listeners and extensions and so on), which are already working with polymorphism. i will change this

Re: [sqlalchemy] polymorphic inheritance and unique constraints

2015-04-14 Thread Richard Gerd Kuesters | Pollux Automation
sorry, i mean i couldn't test it earlier, when i first asked the question :) it was not another co-worker, lol. cheers, richard. On 04/13/2015 06:30 PM, Mike Bayer wrote: On 4/13/15 4:59 PM, Richard Gerd Kuesters | Pollux Automation wrote: well, this didn't work with upstream 1.0 - sorry, I

Re: [sqlalchemy] polymorphic inheritance and unique constraints

2015-04-13 Thread Richard Gerd Kuesters | Pollux Automation
. Richard Gerd Kuesters | Pollux rich...@pollux.com.br wrote: well, understanding better the docs for column conflicts, can i use a declared_attr in a unique constraint? if yes, my problem is solved :) On 03/24/2015 10:33 AM, Michael Bayer wrote: Richard Gerd Kuesters | Pollux rich

Re: [sqlalchemy] Any recommended approach for creating a new dialect?

2015-04-08 Thread Richard Gerd Kuesters | Pollux Automation
Mike, I remember an article of yours where you described much of the process of creating a new dialect for SA, for a Java database if I'm not mistaken. I wasn't able to find it, though. :) On 04/08/2015 01:19 AM, Mike Bayer wrote: On 4/7/15 1:59 PM, Ralph Heinkel wrote: Hello dialect

Re: [sqlalchemy] is True vs ==True

2015-03-30 Thread Richard Gerd Kuesters | Pollux
-- Richard Gerd Kuesters Pollux Automation rich...@pollux.com.br mailto:rich...@pollux.com.br | www.pollux.com.br http://www.pollux.com.br •Linhas de Montagem •Inspeção e Testes •Robótica •Identificação e Rastreabilidade •Software para Manufatura -- You received this message because you

Re: [sqlalchemy] Table Views

2015-03-26 Thread Richard Gerd Kuesters | Pollux
you can use a select as a mapped object if you want, but i don't know if that's what you're looking for. On 03/26/2015 01:54 PM, Philip Martin wrote: am trying to setup schemas particularly related to financial reference data. The data doesn't change very often, but I want to setup a good

Re: [sqlalchemy] polymorphic inheritance and unique constraints

2015-03-25 Thread Richard Gerd Kuesters | Pollux
. Richard Gerd Kuesters | Pollux rich...@pollux.com.br wrote: well, understanding better the docs for column conflicts, can i use a declared_attr in a unique constraint? if yes, my problem is solved :) On 03/24/2015 10:33 AM, Michael Bayer wrote: Richard Gerd Kuesters | Pollux rich

[sqlalchemy] polymorphic inheritance and unique constraints

2015-03-24 Thread Richard Gerd Kuesters | Pollux
hi all! i'm dealing with a little problem here. i have a parent table and its two inheritances. there is a value that both children have and must be unique along either types. is there a way to move this column to the parent and use a constraint in the child? my implementation is postgres

Re: [sqlalchemy] polymorphic inheritance and unique constraints

2015-03-24 Thread Richard Gerd Kuesters | Pollux
thanks again, Mike! just a question: to make the constraint in the parent, shouldn't i move other columns that composes the constraint to the parent too? cheers, richard. On 03/24/2015 10:33 AM, Michael Bayer wrote: Richard Gerd Kuesters | Pollux rich...@pollux.com.br wrote: hi all

[sqlalchemy] auto column naming (declarative)

2015-03-23 Thread Richard Gerd Kuesters | Pollux
hi all! i remember bumping into this somewhere, but now that i need it, i can't find. Murphy ... well, here's the question: * the company i work have a certain convention on naming columns in the database level, like dt_ for datetime, u_ for unicode, ut_ for unicodetext, and so on. the

Re: [sqlalchemy] auto column naming (declarative)

2015-03-23 Thread Richard Gerd Kuesters | Pollux
this, sure. Might be a little tricky: http://docs.sqlalchemy.org/en/rel_0_9/core/events.html?highlight=before_parent_attach#sqlalchemy.events.DDLEvents.before_parent_attach Richard Gerd Kuesters | Pollux rich...@pollux.com.br wrote: hi all! i remember bumping into this somewhere, but now

Re: [sqlalchemy] Old but Gold - SQLA + Twisted

2014-09-08 Thread Richard Gerd Kuesters
hello all :) from the past years, i've been working on solutions to the problem described by Jean (we are co-workers, and we use twisted and sqlalchemy, A LOT), and as everybody may already know, it's a very complicated combination, since we have to do a lot of code around to have a

Re: [sqlalchemy] Old but Gold - SQLA + Twisted

2014-09-08 Thread Richard Gerd Kuesters
with the ORM, any attribute can trigger a SQL query. On Sep 8, 2014, at 9:08 AM, Richard Gerd Kuesters rich...@humantech.com.br mailto:rich...@humantech.com.br wrote: hello all :) from the past years, i've been working on solutions to the problem described by Jean (we are co-workers

Re: [sqlalchemy] Old but Gold - SQLA + Twisted

2014-09-08 Thread Richard Gerd Kuesters
in the operation could be...somehow...*automated*. or to put it another way: why are you comfortable with the ORM's implicit SQL on attribute access, but not with gevent's implicit defer on IO ? On Sep 8, 2014, at 10:47 AM, Richard Gerd Kuesters rich...@humantech.com.br mailto:rich

Re: [sqlalchemy] another quick question regarding abstract classes

2014-06-11 Thread Richard Gerd Kuesters
thanks again Mike! i'll work this here :) my best regards, richard. On 06/10/2014 07:14 PM, Mike Bayer wrote: On Tue Jun 10 15:36:09 2014, Richard Gerd Kuesters wrote: so, here i am again with another weird question, but it may be interesting for what it may come (i dunno yet). the problem

[sqlalchemy] another quick question regarding abstract classes

2014-06-10 Thread Richard Gerd Kuesters
so, here i am again with another weird question, but it may be interesting for what it may come (i dunno yet). the problem: i have a collection of abstract classes that, when requested, the function (that does the request) checks in a internal dictionary if that class was already created or

Re: [sqlalchemy] Entity name - multiple schema - relationship

2014-05-19 Thread Richard Gerd Kuesters
, session.using_bind(some_bind).query(...) http://techspot.zzzeek.org/2012/01/11/django-style-database-routers-in-sqlalchemy/ On May 18, 2014, at 3:28 PM, Richard Gerd Kuesters rich...@humantech.com.br wrote: yeah, well, i was using implicit for little things and explicit for the bigger ones

Re: [sqlalchemy] SQLAlchemy and Informix advice

2014-05-19 Thread Richard Gerd Kuesters
Hi Massimo! In the past, I have used SQLAlchemy to connect to Informix (using the db2 driver), but it was for pure lazyness -- I had to write everything by hand, and my application already was using SQLAlchemy, so ... But that was back in 2007. Those codes are long dead and not in my

Re: [sqlalchemy] Re: SQLAlchemy and Informix advice

2014-05-19 Thread Richard Gerd Kuesters
Massimo, git it a try to the dialect that Mike passed you. I think it should give you a better start then using the ibm_db_sa module. On 05/19/2014 10:40 AM, Massimo Valle wrote: Thank you Richard, about the 2nd question, sorry but I'm new to SQLAlchemy and trying to find a way, so using

Re: [sqlalchemy] Entity name - multiple schema - relationship

2014-05-18 Thread Richard Gerd Kuesters
intensely to figure out how to make them work. On May 17, 2014, at 8:47 PM, Richard Gerd Kuesters rich...@humantech.com.br wrote: in fact, i map classes against different metadata for different schemas, since i like to have specialized parts of my app distributed in the database (the postgres

Re: [sqlalchemy] Entity name - multiple schema - relationship

2014-05-18 Thread Richard Gerd Kuesters
the key to make things work). if I have a metadata bind to some engine, is there a quick (and performatic) way to know it? Em 2014-05-18 16:21, Michael Bayer escreveu: On May 18, 2014, at 12:10 PM, Richard Gerd Kuesters rich...@humantech.com.br wrote: well, this part is still working

Re: [sqlalchemy] Entity name - multiple schema - relationship

2014-05-17 Thread Richard Gerd Kuesters
in fact, i map classes against different metadata for different schemas, since i like to have specialized parts of my app distributed in the database (the postgres part). another part of my app generated sqlite databases on the fly, based on the same structures conceived earlier. kinda strange

Re: [sqlalchemy] selects, mappers and foreign keys

2014-05-11 Thread Richard Gerd Kuesters
i'm asking too much of everything? :) best regards, richard. Em 2014-05-11 00:01, Michael Bayer escreveu: On May 10, 2014, at 7:13 PM, Richard Gerd Kuesters rich...@humantech.com.br wrote: hi all! situation: i'm mapping a select as a class, using mapper. so far so good. problem

Re: [sqlalchemy] selects, mappers and foreign keys

2014-05-11 Thread Richard Gerd Kuesters
thanks Mike, that worked fine. my code, though, didn't went further (i'll have to debug a little bit more) :) best regards, richard. Em 2014-05-11 14:43, Michael Bayer escreveu: On May 11, 2014, at 10:38 AM, Richard Gerd Kuesters rich...@humantech.com.br wrote: thanks Mike

[sqlalchemy] selects, mappers and foreign keys

2014-05-10 Thread Richard Gerd Kuesters
hi all! situation: i'm mapping a select as a class, using mapper. so far so good. problem: some of my selected columns *are* foreign keys in their respective tables, but i would like to say to sqla that they're foreign keys to another mapped class, which have the pks from which those fks

Re: [sqlalchemy] sqlite3 recursivity

2014-04-29 Thread Richard Gerd Kuesters
. On Apr 26, 2014, at 2:10 PM, Richard Gerd Kuesters rich...@humantech.com.br wrote: hi all! as some already know, sqlite3 version 3.8.x (i'm not quite sure if it's 3.8.x, i might be wrong), but it has now support for recursivity using the with operator: https://sqlite.org/lang_with.html [1

[sqlalchemy] self referential hybrid expression

2014-04-28 Thread Richard Gerd Kuesters
hi all, i have a class that have a self reference through *_parent*. this class is mapped against an selectable, not a class (this information is useful, lol) ok, so, using @hybrid_property, i can easily get the amount of children of this class: *@hybrid_property** **def

[sqlalchemy] sqlite3 recursivity

2014-04-26 Thread Richard Gerd Kuesters
hi all! as some already know, sqlite3 version 3.8.x (i'm not quite sure if it's 3.8.x, i might be wrong), but it has now support for recursivity using the with operator: https://sqlite.org/lang_with.html [1] well - probably mike can answear this better - will sqla provide basic support for

[sqlalchemy] job offer for python programmer - brazil

2014-04-17 Thread Richard Gerd Kuesters
about sqlalchemy list Date: Thu, 17 Apr 2014 14:58:15 -0400 From: Michael Bayer mike...@zzzcomputing.com To: Richard Gerd Kuesters rich...@humantech.com.br hi Richard - feel free to forward it on, it's fine. - mike -- You received this message because you are subscribed to the Google

Re: [sqlalchemy] defining a relationship with IS NOT

2014-04-15 Thread Richard Gerd Kuesters
interesting, i didn't knew that :D i was using shomething like (for softwares such as st2, which has pep8 checking): ## variables NULL = None # f**k pep-8 TRUE = True # f**k pep-8 FALSE = False # f**k pep-8 so, somecol != NULL is not acused as violating pep8, lol. well, just for fun :)

Re: [sqlalchemy] defining a relationship with IS NOT

2014-04-15 Thread Richard Gerd Kuesters
yeah, that's why I shared this :) good to know, i'll use that from now on ;) my best regards, richard. On 04/15/2014 09:32 AM, Wichert Akkerman wrote: On 15 Apr 2014, at 13:25, Richard Gerd Kuesters rich...@humantech.com.br mailto:rich...@humantech.com.br wrote: interesting, i didn't

[sqlalchemy] Re: database design question

2014-04-09 Thread Richard Gerd Kuesters
yeah, that's the pain i'm trying to avoid :) i'll probably end up managing multiple connections, but that's a particular design of my app (plugin based, multiple subprocesses, and so on) ... :) On 04/08/2014 06:48 PM, Jonathan Vanasco wrote: I had a similar situation years ago. We had

Re: [sqlalchemy] database design question

2014-04-08 Thread Richard Gerd Kuesters
perhaps this would help? http://techspot.zzzeek.org/2012/01/11/django-style-database-routers-in-sqlalchemy/ i'm willing to use different schemas to my question. if anyone have a better idea, let me know :) best regards, richard. On 04/04/2014 01:58 PM, Richard Gerd Kuesters wrote: hi all

Re: [sqlalchemy] database design question

2014-04-08 Thread Richard Gerd Kuesters
a different database, why not? On Apr 4, 2014, at 12:58 PM, Richard Gerd Kuesters rich...@humantech.com.br mailto:rich...@humantech.com.br wrote: hi all! i have a question about sqlalchemy and database design. i'm developing an app, where each client may receive an alert about the total

Re: [sqlalchemy] database design question

2014-04-08 Thread Richard Gerd Kuesters
: On Apr 8, 2014, at 11:01 AM, Richard Gerd Kuesters rich...@humantech.com.br mailto:rich...@humantech.com.br wrote: thanks mike. i know it's a vague question, but that just the point: i don't know the answer because it can be both :) let me clarify: assuming the application can be self hosted

[sqlalchemy] create relationship after mapping

2014-04-08 Thread Richard Gerd Kuesters
hi all! another question: i'm mapping some classes dinamically, using the mapper() function. i would like to create relationships, but not in the properties kwarg of mapper, but after: *mapper(cls, my_select)** **...** **# detects any relationship** **...** **setattr(cls, 'my_attr'**,

Re: [sqlalchemy] create relationship after mapping

2014-04-08 Thread Richard Gerd Kuesters
stupid me. *mp = **mapper(cls, my_select)** **...** **# detects any relationship** **... mp.add_property(my_attr, relationship(othercls, ...)) *** sorry for thinking out loud (into the group) ... best regards, richard. On 04/08/2014 04:31 PM, Richard Gerd Kuesters wrote: hi all! another

[sqlalchemy] database design question

2014-04-04 Thread Richard Gerd Kuesters
hi all! i have a question about sqlalchemy and database design. i'm developing an app, where each client may receive an alert about the total space usage of their data (files and database), so, using postgresql, i can get them (data usage size) using a different tablespace, database or

  1   2   >