[sqlalchemy] Re: How to use "distinct" in a class based query

2017-10-08 Thread Cornelius Kölbel
2017 09:27:49 UTC+2 schrieb Cornelius Kölbel: > > Hi, > > I have a table with many columns (columnA, columnB, columnC) and I want to > know, how many different entries in columnB are. > I would do such an SQL query: > > select distinct columnB from myTable; > >

[sqlalchemy] How to use "distinct" in a class based query

2017-10-08 Thread Cornelius Kölbel
Hi, I have a table with many columns (columnA, columnB, columnC) and I want to know, how many different entries in columnB are. I would do such an SQL query: select distinct columnB from myTable; I see there is also ``distinct()`` in SQL Alchemy. However - I am using Class defined ORM

Re: [sqlalchemy] DB sync on application level

2015-09-28 Thread Cornelius Kölbel
d email to sqlalchemy@googlegroups.com. > Visit this group at http://groups.google.com/group/sqlalchemy. > For more options, visit https://groups.google.com/d/optout. -- Cornelius Kölbel cornelius.koel...@netknights.it +49 151 2960 1417 NetKnights GmbH http://www.netknights.it Landgraf-Karl-S

[sqlalchemy] What about bit fields / bit masks?

2015-08-29 Thread Cornelius Kölbel
Hello, this is maybe more about the database design. I want to store several boolean states of an object. The object may also have more than one state and the available possible states may increase in future. So I want to avoid adding BOOL columns for every new state and I though, hey, what

[sqlalchemy] subquery? outer join with 3 tables

2014-07-08 Thread Cornelius Kölbel
Hi there, I am wondering how the following would be translated to sqlalchemy. I have three tables: ClientMachine MachineToken Token The table MachineToken acts as n:m mapping between ClientMachine and Token. Each machine can have several tokens assigned. Looks like this:

Re: [sqlalchemy] subquery? outer join with 3 tables

2014-07-08 Thread Cornelius Kölbel
Am 08.07.2014 18:51, schrieb Jonathan Rogers: On 07/08/2014 12:39 PM, Cornelius Kölbel wrote: Hi there, I am wondering how the following would be translated to sqlalchemy. I have three tables: ClientMachine MachineToken Token The table MachineToken acts as n:m mapping

Re: [sqlalchemy] flask sql cann't insert Variable in VALUES

2014-07-04 Thread Cornelius Kölbel
You should take a look into your webservers error log. Kind regards Cornelius Am 04.07.2014 12:19, schrieb 'Frank Liou' via sqlalchemy: I try to insert username in to my table it show Internal Server Error The server encountered an internal error and was unable to complete your

Re: [sqlalchemy] getting error with column name end using geoalchemy2

2014-06-21 Thread Cornelius Kölbel
I once had a very strange error with a table called audit on an oracle database. It turned out, that exspecially on oracle audit was a reserved word - while it worked out fine on any other database. I would recommend trying to use other column names. As end is surrounded by double quites your

[sqlalchemy] filter seams not to work with 0.8.0

2013-03-20 Thread Cornelius Kölbel
Hi list, I have problems when upgrading to SQLAlchemy 0.8.0. I have code like this: audit_q = self.session.query(AuditTable).filter(AuditTable.serial.like('something')).order_by(order_dir) which was running great with mysql on sqlalchemy 0.7.4 With 0.8.0 it seams that I never get results

Re: [sqlalchemy] filter seams not to work with 0.8.0

2013-03-20 Thread Cornelius Kölbel
Am 20.03.2013 15:11, schrieb Cornelius Kölbel: Hi list, I have problems when upgrading to SQLAlchemy 0.8.0. I have code like this: audit_q = self.session.query(AuditTable).filter(AuditTable.serial.like('something')).order_by(order_dir) which was running great with mysql

[sqlalchemy] unicode in where clause on mysql

2012-07-18 Thread Cornelius Kölbel
Hi there, I am trying to do a select on a table, where a user has a /username/ with a German umlaut like kölbel. The table in the mysql-database is utf-8. I also failed when the table was latin1. My problem is that by no(!) chance I manage to match the user and get a row from the select

Re: [sqlalchemy] Re: SA and IBM DB2

2012-07-06 Thread Cornelius Kölbel
Hello, one year gone and I wonder if there might be any news on the question of sqlalchemy and DB2. The previous patches of ibm_db_sa (https://bitbucket.org/jazle/ibm_db_sa/downloads) do not exist anymore. But the current ibm_db_sa 0.1.6 produces an import error at from sqlalchemy import

[sqlalchemy] reserved words in oracle

2012-04-27 Thread Cornelius Kölbel
Hi, I encountered another RESERVED_WORD in oracle: audit As this seems to be a simple patch in sqlalchemy/dialects/oracle/base.py I am just dropping this note. (http://docs.oracle.com/cd/B19306_01/server.102/b14200/ap_keywd.htm) Kind regards Cornelius signature.asc Description: OpenPGP

[sqlalchemy] option is a keyword in oracle

2012-04-26 Thread Cornelius Kölbel
Dear list, I defined a table with a column, that is called option. I got a redhat 5 system with sqlalchemy 0.5.5. When I try to do a paster setup-app the machine tries to create the table which contains columns default and option, but it breaks with an ORA error invalid identifier. It seems

Re: [sqlalchemy] option is a keyword in oracle

2012-04-26 Thread Cornelius Kölbel
Am 26.04.2012 23:22, schrieb Michael Bayer: On Apr 26, 2012, at 5:11 PM, Cornelius Kölbel wrote: Hello Michael, thanks for the answer, thanks for sqlalchemy and thanks for the link. Finally indeed we installed all packages via pip and at least the option problem was gone

Re: [sqlalchemy] change table contents with alembic

2012-04-01 Thread Cornelius Kölbel
Hello again, ok, it could work this way: import sqlalchemy as sa from alembic import context config = context.config engine = sa.engine_from_config( config.get_section(config.config_ini_section), prefix='sqlalchemy.') engine.echo = False metadata =

[sqlalchemy] update table row immediately after writing

2011-05-30 Thread Cornelius Kölbel
Hello, I am using sqlalchemy with pylons. I write audit log messages to table. I use the orm to map my table to my class. orm.mapper(AuditTable, audit_table) self.engine = create_engine(connect_string) metadata.bind = self.engine metadata.create_all()

Re: [sqlalchemy] update table row immediately after writing

2011-05-30 Thread Cornelius Kölbel
regards Cornelius Am 30.05.2011 15:29, schrieb Cornelius Kölbel: Hello, I am using sqlalchemy with pylons. I write audit log messages to table. I use the orm to map my table to my class. orm.mapper(AuditTable, audit_table) self.engine = create_engine(connect_string

Re: [sqlalchemy] No attribute of child relation contained in parent object

2011-01-26 Thread Cornelius Kölbel
Hi List, ok, i figured it out. My understanding of the documentation was a bit different. I really worked out this way. But Thekey in the properties is the attribute name, that will be added to the parent object. So doing this orm.mapper(User, user_table, properties={