Hi Folks,
I have an application that needs to do a certain amount of housekeeping when
objects are deleted or edited. Essentially, I need to keep historical data, so
under some circumstances "deleted" objects actually need to be "obsoleted", and
"edited" objects need to be copied and reference
On 1/15/07, Michael Bayer <[EMAIL PROTECTED]> wrote:
some kind
of OQL.
nooo
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
"sqlalchemy" group.
To post to this group, send emai
in continuing
http://groups.google.com/group/sqlalchemy/browse_thread/thread/4dab6cfae1f62521/8b66851007c6a652?lnk=gst&q=daniel+miller&rnum=2#8b66851007c6a652
, which bizarrely GG will not let me continue, on a closely related but
not exactly the same issue, i broke my limit of people expecting t
Manlio,
I quite like your idea, although I also agree with Michael's "no magic"
philosophy. I identified a similar problem with autoincrementing primary
keys, where a model that worked with one db (say sqlite) would not work
with another (say oracle).
All libraries that try to provide porta
its essentially a "framework" feature, you have a certain idea about
how a fake "schema" might be implemented for databases that dont
explcitly support schemas, such as through table name prefixes or
modified sqlite filenames. both of which are entirely reasonable, for
an application that choose
Michael Bayer ha scritto:
On Jan 15, 2007, at 12:05 PM, Manlio Perillo wrote:
My idea is simple.
1) When the database does not support schema, the schema name specified
in Table costructor should be prepended to the table name.
foo = Table('foo', ..., schema='bar')
result in a tab
at this point the entity_name should get set after your custom
create_instance is called (at least thats in the trunk). init_attr
is not required, it pre-sets attributes on the object that are
otherwise auto-created later (but the autocreation step throws a
single AttributeError per attr
On Jan 15, 2007, at 12:05 PM, Manlio Perillo wrote:
My idea is simple.
1) When the database does not support schema, the schema name
specified
in Table costructor should be prepended to the table name.
foo = Table('foo', ..., schema='bar')
result in a table named bar_foo
why no
Michael Bayer wrote:
you can still override create_instance() as well and try to
spit out subclasses that are otherwise not mapped.
This was something I looked at a while ago as well, and I wasn't sure
what the requirements on objects returned from create_instance were. If
it is not overri
Hi.
I don't know if this already implemented or planned.
Schemas are supported by SQLAlchemy, but unfortunately not all database
supported by SQLAlchemy supports schema.
My idea is simple.
1) When the database does not support schema, the schema name specified
in Table costructor should b
Ah, I see what you mean. Yep, that would work perfectly for me. It would
mean that I would need to set up a mapper for every subclass, but that
is no great hardship (I was half-imagining just mapping the base class,
but that probably has other implications)
Cheers,
Simon
Micheal Bayer wrote:
On 1/15/07, Michael Bayer <[EMAIL PROTECTED]> wrote:
2. no support for "CASCADE" in the "DROP" statement right now. someone
fill me in, is "DROP CASCADE" part of the sql standard ?
yes, at least for tables.
--~--~-~--~~~---~--~~
You received this message becau
you can still override create_instance() as well and try to spit out
subclasses that are otherwise not mapped.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
"sqlalchemy" group.
To post to this group, send email t
1. again, the "constraints" collection wasnt really designed to be
mutable, as other initialization steps are performed when you first
specify ForeignKeyConstraint (or ForeignKey) to Table. if you really
need to use a builder pattern here, make your own collection of columns
and constraints, bu
Ok, I'm recidive ;-).
I want to add a foreign key constraint to "bind" to tables that came
from two separate packages.
I have done:
calendar.components.append_constraint(
sq.ForeignKeyConstraint(
[calendar.components.c.organizer],
[account.accounts.c.username],
ond
right, or implement __setstate__.
On Jan 15, 2007, at 6:07 AM, Manlio Perillo wrote:
Michael Bayer ha scritto:
if you can pickle the object by itself, then id guess youre using
lazy
loaders with the query.options(lazyload('something')) call, which
places per-object lazy loaders (i.e. call
i dont disagree that the Table being mutable would be handy...but
that implies everything else in SA would want to be mutable also.
which also technically is fine, and a lot of SA is mutable. but most
things have exceptions to their mutability (where in python
"exception" means, "it br
im thinking it would just return the string (or whatever) value that
would match the key inside your polymorphic_map. so the polymorphic
map would have a 1->1 key->class mapping, but this function would
allow you to do translations from whatever is in the result set (like
regexps or what
Michael Bayer ha scritto:
you pretty much should construct the Table object the way you want it
to be the first time around,
Being able to change a table definition later is one of the benefit in
using an object oriented database API.
I like the idea to design a table in one (indipendent)
Michael Bayer ha scritto:
if you can pickle the object by itself, then id guess youre using lazy
loaders with the query.options(lazyload('something')) call, which
places per-object lazy loaders (i.e. callables) on your objects.
I'm not sure, since I never use lazy loaders (I use Twisted).
e
Micheal Bayer wrote:
id rather just add another plugin point on MapperExtension
for this, which takes place before the "polymorphic" decision
stage at the top of the _instance method, like
get_polymorphic_identity(). that way you could do all of
this stuff cleanly in an extension (and id d
Michael Bayer wrote:
to have aliases of properties that are usable with get_by(), use the
"synonym" function, described in:
http://www.sqlalchemy.org/docs/adv_datamapping.myt#advdatamapping_properties_overriding
Thank you. Altough the docs are very well done, there are many APIs and
that s
I have tried
select([func.count("*")], from_obj=[table_name]).execute()
but it didn't work
I think you should try to specify a column in your count or leave it empty
(didn't try). If you're using mapped objects, you can use the SelectResults
extension:
from sqlalchemy.ext.selectresults i
milena wrote:
I have tried
select([func.count("*")], from_obj=[table_name]).execute()
but it didn't work
I suppore you're not using mappers, so this is the fastest method:
number_of_rows = table.count().execute().fetchone()[0]
where table is the table object
--~--~-~--~~
I have tried
select([func.count("*")], from_obj=[table_name]).execute()
but it didn't work
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
"sqlalchemy" group.
To post to this group, send email to sqlalchemy@googl
Hi,
does anyone know the syntax of
SELECT COUNT(*) FROM table_name;
for SQLAlchemy? Is there a list of functions (used in SELECT statement)
that exist in SQL that I can use in SQLAlchemy? btw, I am using MySQL.
I need to see if my table is empty (isemty function doesn't work).
Thanks!
--~-
26 matches
Mail list logo