[sqlalchemy] Re: Separate version table

2007-10-29 Thread Arnar Birgisson
e base entity that keeps a changelog of itself is Verkefni (means "project"). A changelog entry is generated by calling changelog_entry on a dirty object. This is not done automatically as sometimes one wants to update an object without generating a log entry. Arnar # -*- encodin

[sqlalchemy] Re: Separate version table

2007-10-29 Thread Arnar Birgisson
On 10/29/07, mmstud <[EMAIL PROTECTED]> wrote: > Thats handy. Where could i get the utils module you're using for Enum > datatype? The Enum datatype is from the ASPN cookbook, with type bindings for SA. Here's part of my utils module. cheers, Arnar # -*- encod

[sqlalchemy] Re: Separate version table

2007-10-28 Thread Arnar Birgisson
d in class.c (i.e. any mapped columns). cheers, Arnar --~--~-~--~~~---~--~~ 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

[sqlalchemy] Re: Separate version table

2007-10-28 Thread Arnar Birgisson
eVersions" refers to it's parent "Page", but "Page" also keeps the version number of the latest version. Arnar # encoding: utf-8 import os from datetime import datetime from sqlalchemy import * from softproof import utils from softproof.json import json

[sqlalchemy] Re: family tree

2007-09-27 Thread Arnar Birgisson
;t work either. > I'll try to use python properties then, I think. You can probably get að "children" property by using a join condition that "or"-s together the join on father_id and mother_id, but it will be read-only at best. I.e. yo

[sqlalchemy] Re: family tree

2007-09-27 Thread Arnar Birgisson
think SA will help you much since the relationship to the child depends strictly on if you are to be it's father or mother (which depends on the parent's gender). SA doesn't do that kind of logic. Besides, it's quite simple to do by h

[sqlalchemy] Re: family tree

2007-09-27 Thread Arnar Birgisson
ildren_mother'), 'father': relation(Person, primaryjoin=persons.c.person_id==persons.c.father_id, backref='children_father') }) Arnar --~--~-~--~~~---~--~~ You received this message because you are subscribed to the

[sqlalchemy] Re: MSSQL, pyodbc & linux

2007-08-13 Thread Arnar Birgisson
E [COLUMNS_1].[TABLE_NAME] = ? AND > [COLUMNS_1].[TABLE_SCHEMA] = ?' ['test_table', 'dbo'] > > > Any hint ? I don't know the mssql parts of SA, but it looks like somewhere the statement is being treated as a collection (statment[0] or similar) so only the &

[sqlalchemy] Re: Hierachical data

2007-08-05 Thread Arnar Birgisson
serialize the > > ElementTree instances to XML in a text field and vice versa. > > Yeah, I thought about that, but I feel it would be harder for me to do > it this way. Ok, you should trust your instinct. Just wanted to point this out as an option. Arnar --~--~-~--~~---

[sqlalchemy] Re: Hierachical data

2007-08-05 Thread Arnar Birgisson
ot;give me all playlists with references to xyz.avi" or "find all nodes of type media_list"? As Michael pointed out, the ElementTree example stores the XML data en-masse, so if you don't need those kind of queries, you might see better performance and a simpler way of life

[sqlalchemy] Re: Hierachical data

2007-08-03 Thread Arnar Birgisson
gth of key)*(length of delimiter). If you have a table of 10 million nodes, a numeric key is at most 7 characters long. A 256 character field would give you 32 levels of recursion minimum, but more in praxis since not all keys will be 7 characters long. Besides, given the operations you listed above

[sqlalchemy] Re: Hierachical data

2007-08-03 Thread Arnar Birgisson
ply nested trees maybe, but it can help in answering the types of queries mentioned above efficiently without requiring you to touch multiple rows upon inserting or deleting. Also, it would be easy to implement in SA and you could have all sorts of convenience methods on a Node class, l

[sqlalchemy] Re: TextMate bundle for SQLAlchemy

2007-07-02 Thread Arnar Birgisson
; one-minute screencast demonstrating a few of them! Excellent, thank you - this will be most useful. I have been using almost identical "table" and "col" snippets myself. The screencast is excellent.. I wouldn't mind having that color scheme as well ;) Arnar --~--~-~--~

[sqlalchemy] Re: Storing JSON objects, maybe OT

2007-06-25 Thread Arnar Birgisson
designing a hierarchical database model. If you still need help and if you want to, feel free to tell us a bit more what you want to do. If it's not an SA issue you can mail me directly if you're more comfortable with that. Arnar --~--~-~--~~~---~--~~ You

[sqlalchemy] Re: Storing JSON objects, maybe OT

2007-06-25 Thread Arnar
r/varchar/text field. Arnar --~--~-~--~~~---~--~~ 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 [EMA

[sqlalchemy] Re: Mapping existing structure of a database

2007-06-04 Thread Arnar Birgisson
abase to a > file and import this as a kind of module? I've had to do this a few times. What I do is I use the autoload once to create the table objects, and then just print'em on the python console. That gives a fairly good starting point that can

[sqlalchemy] Re: InstrumentedList in a boolean context

2007-05-22 Thread Arnar Birgisson
king if sorted(a) == sorted(b) - see if they're the same length. If they're not, there's no need to sort them, you know they'll be different from each other. b) see if using a set (or a dict if you don't have python 2.4, using only the keys) is faster than doing the two sorts and

[sqlalchemy] Re: "set character set" in sqlalchemy?

2007-05-14 Thread Arnar Birgisson
Hi there, You can include a command in the dburi that is executed upon connection start. I use it all the time like this: mysql://user:[EMAIL PROTECTED]:3306/dbname?init_command=set%20character%20set%20utf8 Arnar On 5/14/07, Noam <[EMAIL PROTECTED]> wrote: > > Hello, > >

[sqlalchemy] "Orphaned" parents..

2007-05-04 Thread Arnar Birgisson
, delete the DayTimesheet too? Arnar --~--~-~--~~~---~--~~ 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

[sqlalchemy] Re: PDF Documentation?

2007-04-14 Thread Arnar Birgisson
ctly to PDF (via the ReportLab Toolkit). I have a fair amount of experience with LaTeX and generating automatic layouts with PDF. However I'm going on a holiday next week so I wouldn't be able to do anything about it until April 24th at the earliest. Arnar [1] http://sophos.berkeley.e

[sqlalchemy] Re: (solved) Automatic generation of changelog

2007-04-10 Thread Arnar Birgisson
gt; %s' % (prettyName, trunc(self.gamalt), trunc(self.nytt))) assign_mapper(ctx, AtburdurItem, atburdaskra_items, properties={ '_atburdur': atburdaskra_items.c.atburdur, 'atburdur': relation(Atburdur, backref=backref("items", cascade="all, dele

[sqlalchemy] Re: Automatic generation of changelog

2007-04-04 Thread Arnar Birgisson
Hi again On 4/4/07, Arnar Birgisson <[EMAIL PROTECTED]> wrote: > The third option, creating the changelog-information independent of > the flush - would that mean I can't use a mapper-extension to trigger > it? Do I have any other ways for triggering things on object upda

[sqlalchemy] Re: Automatic generation of changelog

2007-04-04 Thread Arnar Birgisson
"framework friendly" I guess :o) Does it hurt in anyway to use passive=False when I get_history? In some cases I had to in order to get what I want (get_history was returning None). thanks, Arnar --~--~-~--~~~---~--~~ You received this message because yo

[sqlalchemy] Re: Automatic generation of changelog

2007-04-04 Thread Arnar Birgisson
in those and theyll be within the current > transaction. Can I use the ORM inside after_update? I.e. can I create new instances of say HistoryLoggedItem which is a mapped class and expect that to be inserted in the same transaction, or do I need to insert ex

[sqlalchemy] Re: how to do many-to-many on the same table?

2007-04-04 Thread Arnar Birgisson
On 4/4/07, Arnar Birgisson <[EMAIL PROTECTED]> wrote: > I often use a different technique. Instead of keeping two lines in the > association table, I only keep one and make a rule that relateditem1 > <= relateditem2. > > Here is the thread on graphs where Mike posted a

[sqlalchemy] Re: how to do many-to-many on the same table?

2007-04-04 Thread Arnar Birgisson
lution: http://groups.google.com/group/sqlalchemy/browse_frm/thread/4d81b50fbfd84195/8ea809a9532ad6ca The pastebin link in the thread doesn't work any more, but the code can be found here: http://www.sqlalchemy.org/trac/browser/sqlalchemy/t

[sqlalchemy] Re: Automatic generation of changelog

2007-03-31 Thread Arnar Birgisson
Gaetan and Ivo: Sure thing. I'll implement this one way or another monday or tuesday, will post what I end up with. Arnar On 4/1/07, imbunche <[EMAIL PROTECTED]> wrote: > > I'd also apreciate if you post your code later. > > thx in advance. > IvO > >

[sqlalchemy] Re: sqlalchemy.org down?

2007-03-29 Thread Arnar Birgisson
On 3/29/07, Michael Bayer <[EMAIL PROTECTED]> wrote: > > rebooting hopefully it comes up Works for me, thanks. Arnar --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "sqlalchemy" group.

[sqlalchemy] sqlalchemy.org down?

2007-03-29 Thread Arnar Birgisson
I can't reach www.sqlalchemy.org, anyone else having problems? Arnar --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To post to this group, send email to sqlalchemy@goog

[sqlalchemy] Re: Automatic generation of changelog

2007-03-28 Thread Arnar Birgisson
e database into the current session. That history is cleared on session.flush() - right? Arnar --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To post to this group, send email to sqlal

[sqlalchemy] Automatic generation of changelog

2007-03-28 Thread Arnar Birgisson
what columns of the mapped table have changed? How do I hook into the update action - I think I need a mapper extension, but can you point me to some examples? Has anyone done something similar (the whole changelog thing) with SA? Arnar --~--~-~--~~~---~--~~ You r

[sqlalchemy] Re: What should the future of SQLAlchemy Query look like ?

2007-03-10 Thread Arnar Birgisson
I like it all! Arnar On 3/10/07, Michael Bayer <[EMAIL PROTECTED]> wrote: > > Well initial response to this post has been overwhelmingly low, but > thats fine with me. After trying to tackle this today, I realized > that I actually didnt want to add a brand new query object

[sqlalchemy] Re: Parameters not handled correctly with adodbapi

2007-02-17 Thread Arnar Birgisson
be someday if the DB-API becomes defunct due to microsoft dropping support for it.. It's good to hear that someone is working on pyodbc support in SA. Arnar On 2/17/07, Paul Johnston <[EMAIL PROTECTED]> wrote: > > Arnar, > > I agree that is an adodbapi problem; I have seen t

[sqlalchemy] Re: Parameters not handled correctly with adodbapi

2007-02-15 Thread Arnar Birgisson
Hi all, I have a small program demonstrating this without SA, so the problem seems to be adodbapi specific. I'll be posting to their list and I don't want to crosspost here too, so anyone interested in the problem can have a look at the adodbapi archives. Arnar On 2/15/07, Arnar

[sqlalchemy] Re: Parameters not handled correctly with adodbapi

2007-02-15 Thread Arnar Birgisson
nvarchar(1). Any other ideas? Arnar On 2/14/07, Rick Morrison <[EMAIL PROTECTED]> wrote: > The problem is most likely in the table definition which defines the > "dataset" column as a Unicode type. A recent patch for adodb makes that an > NVARCHAR field, vs. a simple VARCHAR

[sqlalchemy] Parameters not handled correctly with adodbapi

2007-02-14 Thread Arnar Birgisson
r(1),@P2 int,@P3 int,@P4 int',N'O',0,4,6 Here you can see that the first parameter is givent the type nvarchar(1) and the value N'O'. I assume this is b/c somewhere the parameter is handled as a list - and being a string messes things up. Maybe because I'm using unicod

[sqlalchemy] Re: Announcing Elixir!

2007-02-13 Thread Arnar Birgisson
My vote would be to keep both, but only if you allow them to be mixed. Arnar --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To post to this group, send email to sqlalchemy@googlegroups

[sqlalchemy] Re: Adding "with (nolock)" to all queries (mssql)

2007-02-12 Thread Arnar Birgisson
Hi On 2/12/07, Michael Bayer <[EMAIL PROTECTED]> wrote: > On Feb 12, 4:25 am, "Arnar Birgisson" <[EMAIL PROTECTED]> wrote: > > Hi again, > > > > Yes, we thought that might be the case. We tried changing the > > isolation level on this connec

[sqlalchemy] Re: Adding "with (nolock)" to all queries (mssql)

2007-02-12 Thread Arnar Birgisson
ct has no attribute 'strategy' and another error is "object not subscriptable" when doing something like "eststatus = result.fetchone()[0]" Any ideas? Arnar TypeError: unsubscriptable object On 2/9/07, Michael Bayer <[EMAIL PROTECTED]> wrote: > > > before

[sqlalchemy] Re: Adding "with (nolock)" to all queries (mssql)

2007-02-08 Thread Arnar Birgisson
post so I deducted from your question that I had a choice :o) Anyways, freetds has always been a pain in my ... neck, I've moved a few projects over to windows servers. Let's say that I do that, should I use pymssql or adodbapi? Arnar --~--~-~--~~~---~--~~ You

[sqlalchemy] Re: Adding "with (nolock)" to all queries (mssql)

2007-02-08 Thread Arnar Birgisson
Ok. Should I rather be using adodbapi then? Arnar On 2/8/07, Rick Morrison <[EMAIL PROTECTED]> wrote: > > Pymssql runs on top of the ancient library DB-lib, which has real > issues with not fully reading all query results -- make sure all your > query results are fully consum

[sqlalchemy] Re: Adding "with (nolock)" to all queries (mssql)

2007-02-08 Thread Arnar Birgisson
ing at all. DB connections would lock up until there were no left in the pool and this happend quite fast, in about 20 minutes. I moved the part of the application that speaks to mssql over to mod_python/apache and that solved the problem while we were running on sql server 2000. I'll tr

[sqlalchemy] Adding "with (nolock)" to all queries (mssql)

2007-02-08 Thread Arnar Birgisson
ble alias in every query (I'm only doing selects). The problem is that the queries are built and executed with SA. Can I plug into some hooks or something to do this? Arnar --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Googl

[sqlalchemy] Re: Foreign key not updated

2007-01-05 Thread Arnar Birgisson
Ok, thanks :o) Arnar --~--~-~--~~~---~--~~ 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 [EMAI

[sqlalchemy] Re: Foreign key not updated

2007-01-04 Thread Arnar Birgisson
On 1/4/07, Michael Bayer <[EMAIL PROTECTED]> wrote: Arnar Birgisson wrote: > On 1/3/07, Michael Bayer <[EMAIL PROTECTED]> wrote: > > yeah that would be why. SA's ORM has no ability to update primary key > > columns from their original valueyoull have to upd

[sqlalchemy] Re: Foreign key not updated

2007-01-04 Thread Arnar Birgisson
t silently flushed the uow session without making any updates - leaving the model in inconsistent state with the database. Shouldn't there be some kind of error? Arnar --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Grou

[sqlalchemy] Foreign key not updated

2007-01-03 Thread Arnar Birgisson
s not update the foreign key of the child. One contributing factor might be that the foreign key is also a part of the child's primary key - but I'm not sure. Any ideas? Should I submit this as a bug? Arnar --~--~-~--~~~---~--~~ You received this message

[sqlalchemy] Re: SQLAlchemy 0.3.2 released

2006-12-12 Thread Arnar Birgisson
the BSD licensed version. Arnar --~--~-~--~~~---~--~~ 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

[sqlalchemy] Re: MySQL Has Gone Away

2006-12-08 Thread Arnar Birgisson
r, so that at least the pool doesnt get filled up > with busted connections. So in a webserver environment this makes just the request where the error happens fail, instead of making all subsequent requests on the same thread fail.. correct? If so, half the b

[sqlalchemy] Re: Mapping a graph data structure

2006-11-03 Thread Arnar Birgisson
ances().  I think im going to try to express this in thedocumentation...Nice, thanks. The version you pasted is exactly the "elegant" way I wanted to "find"* I hope this was a helpful excercise for others besides myself. :)Arnar* on a philosophical note: are programs, like mathe

[sqlalchemy] Re: Mapping a graph data structure

2006-11-03 Thread Arnar Birgisson
cted graphs, but makes queries easier and allows you to store directed graphs as well.  Maybe that's useful? Maybe not. It was fun to think about it anyway. Same here.. I actually have no use for this in any of my projects.. just  some recreational programming :)Arnar --~--~-~--~~--

[sqlalchemy] Mapping a graph data structure

2006-11-01 Thread Arnar Birgisson
Hi there,There was a question on IRC yesterday on how to map a graph (as in nodes and edges) with SA. I didn't have much time to dwell on this but this was a start: http://paste.ufsoft.org/90 I was curious if someone has done this successfully? The problem I have with the above is that the "viewonl

[sqlalchemy] Re: Problem deleting child objects of a relationship with multi-column key

2006-10-13 Thread Arnar Birgisson
; then it worked in SQLite. this had to be tested in postgres, which is > strict about foreign key enforcement. to test in postgres, the > composite foreign keys had to be specified properly, using > ForeignKeyConstraint. after that, the whole program completes. > attached to this em