Re: [sqlalchemy] How to return object with maximum column via a mapper?

2010-02-18 Thread Hermann Himmelbauer
Am Donnerstag 18 Februar 2010 02:07:15 schrieb Michael Bayer: > On Feb 17, 2010, at 12:27 PM, Hermann Himmelbauer wrote: > > Hi, > > I have the following many to one relation: > > > > - A bank account table (acc) > > - An Interest rate table, which relates to the

[sqlalchemy] How to return object with maximum column via a mapper?

2010-02-17 Thread Hermann Himmelbauer
Hi, I have the following many to one relation: - A bank account table (acc) - An Interest rate table, which relates to the account table. Colums are an ID, a rate (decimal), a date and a flag outlining if the interest rate is credit or debit ('H' / 'S') - One account may have multiple interest r

Re: [sqlalchemy] SQLAlchemy 5.4.p1 - RuntimeError - why?

2009-11-26 Thread Hermann Himmelbauer
Am Dienstag 24 November 2009 22:23:49 schrieb Michael Bayer: > I see "0.5.4p1" ! upgrading is always the first response. this was a > bug that was fixed. Thanks a lot, this seems to have solved it! Best Regards, Hermann -- herm...@qwer.tk GPG key ID: 299893C7 (on keyservers) FP: 0124 2584 88

[sqlalchemy] SQLAlchemy 5.4.p1 - RuntimeError - why?

2009-11-24 Thread Hermann Himmelbauer
Hi, I'm experiencing some interesting error here with SQLAlchemy: When I execute one of my functions, which do a simple session.query, the following traceback occurs, but only sometimes - no clue why and when: --- snip --- File "/home/bank/zbsp/buildout/s

[sqlalchemy] How to check for references before deleting?

2009-07-16 Thread Hermann Himmelbauer
Hi, I use in my database tables, that reference other tables, e.g. table A -> table B. In my deletion routine, I want to prohibit people to delete rows from A, which have references to B. How would I do that? My first approach was to rely on the databases referential integrity and catch relat

[sqlalchemy] session.begin_nested() (=Savepoints) on SQLite

2009-05-08 Thread Hermann Himmelbauer
Hi, I'm currently trying to use savepoints on SQLite, however, there are some problems with it which I don't understand. The following traceback occurs quite often: - snip -- File "/home/dusty/prog/bsp/buildout/src/bsp/bsp/tests/__init__.py", line 156,

[sqlalchemy] Session does not write updated object attribute (no SQL update) (SA 0.4.6)

2008-10-10 Thread Hermann Himmelbauer
Hi, I created a custom type that represents a string as list of int(elements), e.g.: "" <-> [2, 2, 2, 2] The class I created looks as follows: class IntList(types.TypeDecorator): """List of integers that is represented by string in the RDB""" impl=String def process_bind_p

[sqlalchemy] Re: commit vs flush

2008-09-08 Thread Hermann Himmelbauer
Am Montag 08 September 2008 13:29:17 schrieb Kyle Schaffrick: > On Mon, 8 Sep 2008 13:22:53 +0300 > > [EMAIL PROTECTED] wrote: > > maybe separate the objects to-be-saved from not-yet-to-save in your > > app.code and dont leave that to SA? > > do something, flush+commit, then do the rest... > > I a

[sqlalchemy] Re: How to create constraints for mappers (for SA 0.4.7)?

2008-08-26 Thread Hermann Himmelbauer
Am Dienstag 26 August 2008 01:41:20 schrieb David Gardner: > I think what you might want to do is something like this: > > a_query=select([a_table,b_table], > b_table.c.sometext!='NOTHISONE').alias('a_query') > mapper(AObject, q_query) Interesting, thanks - yes, that might a solution, although, i

[sqlalchemy] Re: How to create constraints for mappers (for SA 0.4.7)?

2008-08-26 Thread Hermann Himmelbauer
Am Montag 25 August 2008 22:37:47 schrieb Michael Bayer: > On Aug 25, 2008, at 12:22 PM, Hermann Himmelbauer wrote: > > Hi, > > I'm wondering if the following is possible with mappers: > > > > I have two tables A and B, whereas B is referenced by A. What I need &

[sqlalchemy] How to create constraints for mappers (for SA 0.4.7)?

2008-08-25 Thread Hermann Himmelbauer
Hi, I'm wondering if the following is possible with mappers: I have two tables A and B, whereas B is referenced by A. What I need is a special mapper for A that returns all referenced rows in B except those, that have a specific value in one column of the row, e.g.: Table A: id, sometext, reft

[sqlalchemy] Display SQL of "create table"

2008-07-09 Thread Hermann Himmelbauer
Hi, Is there a simple way to display the create statements of SA Tables? If I do a my_table.create(), some SQL is created and executed, is there a way to find retrieve this as a string without creating the table? Best Regards, Hermann -- [EMAIL PROTECTED] GPG key ID: 299893C7 (on keyservers)

[sqlalchemy] Re: Multiple encodings in my database

2008-06-26 Thread Hermann Himmelbauer
Am Freitag, 27. Juni 2008 01:20 schrieb Michael Bayer: > first of all, the stack trace suggests you have not set the "encoding" > parameter on create_engine() as it's still using UTF-8. > > If you mean that a single database column may have different encodings > in different rows, you want to do y

[sqlalchemy] Multiple encodings in my database

2008-06-26 Thread Hermann Himmelbauer
Hi, I'm trying to access a database via SA, which contains varchars with different, arbitrary encodings. Most of them are ascii or ISO-8859-2 encoded, however, many are windows-1252 encoded and there are also some other weird ones. In my engine setup, I set the encoding to latin1 and set conve

[sqlalchemy] Re: Unique ID's

2008-01-20 Thread Hermann Himmelbauer
Am Montag, 21. Januar 2008 01:16 schrieb Morgan: > Hi Guys, > > I have field that I want to put a unique identifier in. This unique Id i > would like to be a composite key or simply a random number. What do you > guys suggest for this, is there a particular method which works well for > some of yo

[sqlalchemy] Re: Error while setting default dates on a table with default=func.now()

2008-01-18 Thread Hermann Himmelbauer
Am Freitag, 18. Januar 2008 22:43 schrieb Michael Bayer: > On Jan 18, 2008, at 10:59 AM, Hermann Himmelbauer wrote: > > Hi, > > I have a table that looks appr. like this (I deleted some columns): > > > > table_acc = Table( > >'konto', metadata, &g

[sqlalchemy] Error while setting default dates on a table with default=func.now()

2008-01-18 Thread Hermann Himmelbauer
Hi, I have a table that looks appr. like this (I deleted some columns): table_acc = Table( 'konto', metadata, Column('kontoid', Integer, primary_key=True, key='accid'), Column('erdat', DateTime, default=func.now(), key='datopen')) What I'd like to accomplish is that when during an in

[sqlalchemy] Re: SQLAlchemy 0.4.0 Released

2007-10-17 Thread Hermann Himmelbauer
Am Mittwoch, 17. Oktober 2007 21:40 schrieb Michael Bayer: > Hey list - > > I'm very happy to announce that we've put out 0.4.0 final. Thanks > to all the contributors as well as all the beta testers who have > helped us move through six beta releases, just to make sure we've got > everything ri

[sqlalchemy] Re: Aliasing table and column names

2007-10-16 Thread Hermann Himmelbauer
Am Montag, 15. Oktober 2007 20:14 schrieb Michael Bayer: > HI Hermann - > > table/column naming looks like this: > > mytable = Table('sometablename', metadata, > Column('colname', Integer, key='someothername') > ) > > access the column: > > mytable.c.someothername > > so above, we access the

[sqlalchemy] Aliasing table and column names

2007-10-15 Thread Hermann Himmelbauer
Hi, I'm currently implementing an application, which accesses a database that's implemented in german. Table and column names are all in german. As some english-only speaking programmers are involved in the development, I'm considering renaming them to english, as otherwise, these german identi

[sqlalchemy] Bug in SA-0.4b6

2007-09-27 Thread Hermann Himmelbauer
Hi, I have problem here with SA-0.4b6: I created an own table that inherits from sqlalchemy.Table like this: class MyTable(sqlalchemy.Table): pass When I now create tables using this class (e.g. mytable = MyTable(...)), the tables are not created via metadata.create_all(). The log files de

[sqlalchemy] Re: Feature suggestion: Description attribute in Tables/Columns

2007-09-19 Thread Hermann Himmelbauer
Am Mittwoch, 19. September 2007 23:44 schrieb Paul Johnston: > Hi, > > >For my documentation, it is very handy to gather the table definitions > >directly from my SQLAlchemy-based python code - that's relatively easy, I > > This would be useful for me too, and it would be good to have hooks to > s

[sqlalchemy] Feature suggestion: Description attribute in Tables/Columns

2007-09-17 Thread Hermann Himmelbauer
Hi, I am creating my database via SQLAlchemy, therefore I use several "Column()" objects in a Table() clause. For my documentation, it is very handy to gather the table definitions directly from my SQLAlchemy-based python code - that's relatively easy, I simply import my table-definitions file

[sqlalchemy] Re: Automatically loading data into objects

2007-09-17 Thread Hermann Himmelbauer
Am Freitag, 14. September 2007 23:52 schrieb jason kirtland: > Hermann Himmelbauer wrote: > > Hi, > > In one of my database tables I have a varchar that is mapped to an object > > with a string attribute. This specific varchar should however be > > represented

[sqlalchemy] Profiling support

2007-09-14 Thread Hermann Himmelbauer
Hi, I'd like to know if there is some profiling support in SQLAlchemy. It would be nice if there would be some data accompanying SQL statements in the logfiles that can be used to optimize the RDB-part of the application (e.g. lazy/eager loading, specifying queries, creating indexes etc.). How

[sqlalchemy] Automatically loading data into objects

2007-09-14 Thread Hermann Himmelbauer
Hi, In one of my database tables I have a varchar that is mapped to an object with a string attribute. This specific varchar should however be represented by a certain Python object, therefore it would be very handy, if there would be a way to automatically load/represent this data. Is there su

[sqlalchemy] Re: How to safely increasing a numeric value via SQLAlchemy

2007-09-11 Thread Hermann Himmelbauer
Am Dienstag, 11. September 2007 10:54 schrieb svilen: > in 0.4 there is atomic update, e.g. update set a=expression > > syntax is something like > table.update( values=dict-of-name-expression ).execute( > **bindings-if-any) > expressions is whatever sa sql expression Ah, that's interesting. Is it

[sqlalchemy] How to safely increasing a numeric value via SQLAlchemy

2007-09-10 Thread Hermann Himmelbauer
Hi, I need to safely increase a numeric value via SQLAlchemy: I have a table that has a column with numeric data. For increasing the value, I need to read the data, add some value and store it, so it would look like that: - select myvalue from mytable - myvalue += 123 - update mytable and set m

[sqlalchemy] Re: How to dynamically create where-clauses

2007-08-10 Thread Hermann Himmelbauer
Am Freitag, 10. August 2007 15:02 schrieb Christoph Haas: > On Fri, Aug 10, 2007 at 02:51:51PM +0200, Hermann Himmelbauer wrote: > > My web-application, that is in front of SQLAlchemy has various > > input-fields, which should act as a where-clause (with like()), a query > >

[sqlalchemy] How to dynamically create where-clauses

2007-08-10 Thread Hermann Himmelbauer
Hi, My web-application, that is in front of SQLAlchemy has various input-fields, which should act as a where-clause (with like()), a query looks e.g. like this: session.query(MyObj).filter(table1.c.input1.like(inputfield_1+'%'), table1.c.input2.like(inputf

[sqlalchemy] Automatic converter from latin1 to Unicode

2007-08-09 Thread Hermann Himmelbauer
Hi, I am writing a web application which retrieves data through SQLAlchemy. Character-based data in this database is encoded as latin1. My Web-framework (Zope3) expects strings in the unicode format and throws errors like this: UnicodeDecodeError: 'ascii' codec can't decode byte 0xfc in posit

[sqlalchemy] MySQL MaxDB interface for SQLAlchemy

2007-06-05 Thread Hermann Himmelbauer
Hi, It seems SQLAlchemy provides no database connector for MySQL's SAPDB/MaxDB database and that there is no ongoing work in this direction. I'm currently working on a project, which relies on MaxDB, therefore I need such a connector. As I am not involved in the SQLAlchemy development, writing

[sqlalchemy] MaxDB database interface

2007-06-04 Thread Hermann Himmelbauer
Hi, Does someone know if there's a database interface for MySQL's MaxDB or if someone is developing it? If not - is it much effort to develop that? Best Regards, Hermann -- [EMAIL PROTECTED] GPG key ID: 299893C7 (on keyservers) FP: 0124 2584 8809 EF2A DBF9 4902 64B4 D16B 2998 93C7 --~--~--

[sqlalchemy] Re: Accessing attributes in many to many relations

2007-01-09 Thread Hermann Himmelbauer
Am Dienstag, 9. Januar 2007 17:01 schrieb Michael Bayer: > we do have an extension called "associationproxy" that is used for > something similar with association objects...it may give you some > ideas on how to proxy attributes across. i dont think you should > approach the idea of "adding indi