[sqlalchemy] Re: Announcing Elixir!

2007-02-13 Thread Robert Gravina
On Feb 13, 2007, at 4:35 AM, Jonathan LaCour wrote: Today, we are pleased to announce the release of Elixir (http://elixir.ematia.de), a declarative mapper for SQLAlchemy. Great work! I'm new to SQLAlchemy, but after defining my model for my first project I thought that it was

[sqlalchemy] Re: Announcing Elixir!

2007-02-13 Thread Ed Singleton
On 12/02/07, Jonathan LaCour [EMAIL PROTECTED] wrote: Today, we are pleased to announce the release of Elixir (http://elixir.ematia.de), a declarative mapper for SQLAlchemy. Elixir is the successor to ActiveMapper and TurboEntity, and is a collaboration between Daniel Haus, Jonathan LaCour

[sqlalchemy] Re: Function Indexes

2007-02-13 Thread Troy
A common use of functional indexes for Postgres and Oracle is to apply a upper or lower to a character column for case insensitive searching and ordering. For example, with the following people table: id name -- 1 adam 2 Troy select name from people where

[sqlalchemy] Re: Announcing Elixir!

2007-02-13 Thread Jonathan LaCour
I am moving this thread over to [EMAIL PROTECTED] to continue the discussion, so please reply over there :) Ed Singleton wrote: As someone who was resisting moving to SQLAlchemy due to the apparent complexity, I've had a look through the introduction and the sample TG app, and this looks

[sqlalchemy] Re: Announcing Elixir!

2007-02-13 Thread skip . montanaro
Jonathan Anyway, we might just end up keeping both... I say punt and pick one. Even it it's a coin flip. Skip --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups sqlalchemy group. To post to this group, send

[sqlalchemy] query on table-inheritance, self-referencing mappers

2007-02-13 Thread svilen
hi. Here is a simple case which does not work - or i cannot figure out how to make it work. 'give all engineers which have helper employee of age =20'; where Engineer inherits Employee via table-inheritance. i've tried multiple ways to achieve the result - neither works, in different ways.

[sqlalchemy] Re: default_metadata and threadlocal

2007-02-13 Thread Michael Bayer
just make your own global variable. i dont like default_metadata at all. On Feb 13, 7:38 am, Manlio Perillo [EMAIL PROTECTED] wrote: Michael Bayer ha scritto: its threadlocal because its imitating some global context people are accustomed to from SQLObject. Ok, thanks. Just to know.

[sqlalchemy] Is there any way to call a python function for primary key generation

2007-02-13 Thread vinjvinj
I use the mx.UID package to generate all my keys. Is there any way to specify that this function be called to generate the primary key for inserts? Thanks, VJ --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups

[sqlalchemy] Re: Never-saved orphans are an error?

2007-02-13 Thread Michael Bayer
On Feb 12, 9:27 pm, SteveTether [EMAIL PROTECTED] wrote: I checked sess.new after the del and there it was, without my having called sess.save() on it. In my application I was after fully explicit control of sess.save() operations, applying them only to members of the data structure and

[sqlalchemy] Re: query on table-inheritance, self-referencing mappers

2007-02-13 Thread Michael Bayer
THANK YOU for the nice test case that does not require untarring 35 files ! sorry for pushing more of the effort off. ill take a look at this later today. On Feb 13, 11:17 am, svilen [EMAIL PROTECTED] wrote: hi. Here is a simple case which does not work - or i cannot figure out how to make

[sqlalchemy] Re: Announcing Elixir!

2007-02-13 Thread Michael Bayer
congrats to jonathan and team ! looking forward to some of the SA support burden moving over :) On Feb 12, 2:35 pm, Jonathan LaCour [EMAIL PROTECTED] wrote: Today, we are pleased to announce the release of Elixir (http://elixir.ematia.de), a declarative mapper for SQLAlchemy. Elixir is

[sqlalchemy] Re: Some open tickets

2007-02-13 Thread Paul Johnston
Hi, Ticket #422: Oh dear! I seem to have made a bit of a hash of this. Most of your comments relate to patch 1, which has actually already been committed. The other controversial bit was the change to ClauseList http://www.sqlalchemy.org/trac/wiki/ClauseList.compare. What I've done is roll

[sqlalchemy] Re: query on table-inheritance, self-referencing mappers

2007-02-13 Thread Michael Bayer
taking a look, i think what you should do is use an alias of the table_Employee in your queries. since the engineer mapper is using joined table inheritance, the default table_Employee is already going to be involved in the query, so your external join condition needs to be off a distinct alias

[sqlalchemy] Re: Is there any way to call a python function for primary key generation

2007-02-13 Thread vinjvinj
Found the answer: # a function to create primary key ids i = 0 def mydefault(): global i i += 1 return i t = Table(mytable, meta, # function-based default Column('id', Integer, primary_key=True, default=mydefault), # a scalar default Column('key', String(10),

[sqlalchemy] Re: Cascade-Delete causes AssertionError (Tries to blank-out primary key ...)

2007-02-13 Thread Nebur
On 12 Feb., 18:17, Luke Stebbing [EMAIL PROTECTED] wrote: Right, delete-orphan is what adds the lifecycle relationship between parent and child. It means that the child can't exist without a parent. That lets SA know that it should eliminate the child rather than trying to null out the

[sqlalchemy] Re: Is there any way to call a python function for primary key generation

2007-02-13 Thread Gary Bernhardt
On 2/13/07, vinjvinj [EMAIL PROTECTED] wrote: Found the answer: # a function to create primary key ids i = 0 def mydefault(): global i i += 1 return i This counter is going to start over every time you run your program. The second time you run it, it's going to start

[sqlalchemy] Newbie question about select statement

2007-02-13 Thread Cristiano Paris
I everyone. I'm pretty new to SQLAlchemy and never done much sql-related work in the past as well so this could possibly be a silly question. Suppose I've a table with a huge number of records. Now, I'd like to access this table randomly through a list-like interface of a Python class instance,

[sqlalchemy] MS-SQL: specifying COLUMNS_TABLE_SCHEMA, using table_iterator()

2007-02-13 Thread metaperl
I'm wondering where I can specify that the tables that I want are in the schema DataTables instead of 'dbo'. The engine.echo outuput shows that for some reason my connection defaulted to the dbo schema, which is not currently desired. Second, the database that I connected to has tables in both

[sqlalchemy] Re: Newbie question about select statement

2007-02-13 Thread Gary Bernhardt
The Working with Large Collections section in the advanced mapping docs is probably what you want: http://www.sqlalchemy.org/docs/adv_datamapping.myt#advdatamapping_properties_working On 2/13/07, Cristiano Paris [EMAIL PROTECTED] wrote: I everyone. I'm pretty new to SQLAlchemy and never done

[sqlalchemy] Re: SQL echoing?

2007-02-13 Thread saxon75
I traced through the source a little and it appears that line 309 in orm/strategies.py is what's causing these lines to be printed. Looking through the repository, I see it's been corrected as of r2255. (I was using r2251). On Feb 11, 9:20 pm, Michael Bayer [EMAIL PROTECTED] wrote: something

[sqlalchemy] convert_unicode=True returns 'str' type instead of 'unicode' type

2007-02-13 Thread michi
Hello, I'm trying to select string as unicode using postgresql. Here is what I do: ### begin code db = create_engine(postgres://..., convert_unicode=True) con = db.connect() result = con.execute(select 'a') for a in result: ... for attr in a: ... print type(attr) ... type

[sqlalchemy] Re: Newbie question about select statement

2007-02-13 Thread Michael Bayer
also look into the SelectResults extension which will do the somelist[90] == SELECT ... OFFSET 90 LIMIT 1 thing. its in the plugins section of the docs. On Feb 13, 4:05 pm, Gary Bernhardt [EMAIL PROTECTED] wrote: The Working with Large Collections section in the advanced mapping docs is

[sqlalchemy] Re: Is there any way to call a python function for primary key generation

2007-02-13 Thread vinjvinj
This counter is going to start over every time you run your program. The second time you run it, it's going to start creating IDs that already exist, You missed my first post, which stated: I use the mx.UID package to generate all my keys. Is there any way to specify that this function be

[sqlalchemy] Re: Calculated columns

2007-02-13 Thread Mike Orr
On 2/12/07, Jonathan Ellis [EMAIL PROTECTED] wrote: Instead of mapping your table directly, map a select containing the coalesce: incidents_with_activity = select([incidents, func.coalesce(...).label('activity')]).alias('incidents_with_activity') assign_mapper(Incident,

[sqlalchemy] Re: convert_unicode=True returns 'str' type instead of 'unicode' type

2007-02-13 Thread michi
Hi Michael, Thank you for your response. I have one question: 1. By constructed SQL, do you mean something like select * from table_name? If that's the case, I tried it, and it still returns str. Again, thank you for your quick response, --Michi On Feb 13, 2:44 pm, Michael Bayer [EMAIL

[sqlalchemy] Re: Is there any way to call a python function for primary key generation

2007-02-13 Thread Gary Bernhardt
On 2/13/07, vinjvinj [EMAIL PROTECTED] wrote: This counter is going to start over every time you run your program. The second time you run it, it's going to start creating IDs that already exist, You missed my first post, which stated: I most certainly did. My apologies. :) I use the

[sqlalchemy] Re: Cascade-Delete causes AssertionError (Tries to blank-out primary key ...)

2007-02-13 Thread Michael Bayer
OK its fixed in r2314. the cascade from User.meta does take effect, its just that the combination primary key/foreign key column on the t_userdata table was being blanked out when the deletion of the User took place, i.e. it was not checking first that the Userdata was also being deleted.

[sqlalchemy] Re: convert_unicode=True returns 'str' type instead of 'unicode' type

2007-02-13 Thread michi
I see, I'll give it a try. Thank you! --Michi On Feb 13, 4:05 pm, Michael Bayer [EMAIL PROTECTED] wrote: i mean like, t = Table(sometable, metadata, Column(...)) s = select([t], t.c.somecol==5) thats constructed SQL. constructed SQL has some support for literal strings. you should be

[sqlalchemy] Re: Is there any way to call a python function for primary key generation

2007-02-13 Thread Sean Davis
On 2/13/07, vinjvinj [EMAIL PROTECTED] wrote: I use the mx.UID package to generate all my keys. Is there any way to specify that this function be called to generate the primary key for inserts? Thanks, Could this not be done on the database side (depends on the RDBMS)? Sean

[sqlalchemy] Re: Is there any way to call a python function for primary key generation

2007-02-13 Thread vinjvinj
Nice thing about using mx.UID package is that it is portable between database. The UID that is generated has a portion that is derived from the machine and time, so it is always going to be unique. On Feb 13, 8:52 pm, Sean Davis [EMAIL PROTECTED] wrote: On 2/13/07, vinjvinj [EMAIL PROTECTED]