Re: [sqlalchemy] accessing firebird on windows from linux

2016-05-17 Thread robert rottermann
backwards to get the right URL. On 05/17/2016 10:42 AM, robert rottermann wrote: Hi there, I try to access a firebird db on windows from my ubuntu box. I have a gui-tool (FlameRobin), from which this works nicely. Therefore it is not a firewall or access problem. Now I would like to do

[sqlalchemy] accessing firebird on windows from linux

2016-05-17 Thread robert rottermann
Hi there, I try to access a firebird db on windows from my ubuntu box. I have a gui-tool (FlameRobin), from which this works nicely. Therefore it is not a firewall or access problem. Now I would like to do it using python and sqlalchemy. So far I failed.. This is the connection string I use:

[sqlalchemy] sql works when run manually, not when part of sqlalchemy query

2015-11-24 Thread robert rottermann
Hi there, DB: mysql 5.5.46-0ubuntu0.12.04.2 Python: 2.7.3 SQLAlchemy-1.0.9-py2.7-linux-x86_64.egg snippet that provokes trace back: c = tblMembership.__table__.c records = session.query(tblMembership).filter(c['idPerson'] == member_id).all() I use a zope/plone python

[sqlalchemy] postgis samples problem (AttributeError: 'module' object has no attribute 'Function')

2014-04-05 Thread robert rottermann
Hi there, I try to run the sample at: http://docs.sqlalchemy.org/en/rel_0_9/_modules/examples/postgis/postgis.html but I get the following traceback: Traceback (most recent call last): File scripts/test_geom.py, line 18, in module class BinaryGisElement(GisElement, expression.Function):

[sqlalchemy] problems with mysql reflect

2014-02-10 Thread robert rottermann
Hi there, I have a mysql database that I use on several linux boxes. No I get the following error on on of them: Traceback (most recent call last): File ../bin/zopepy, line 317, in module execfile(__file__) File t.py, line 38, in module BaseA.metadata.reflect(local_engine_a) File

[sqlalchemy] how to use ForeignKeyConstraint ?

2013-02-24 Thread robert rottermann
Hi there, I have a bunch of mysql tables. Up to now I did not define their structure in python but used Base.metadata.reflect(engine) No I started to define their structure in Python and stumbled over the fact, that I do not understand how ForeignKeyConstraint should be used correctly. The

Re: [sqlalchemy] SqlAlchemy dynamic query generation

2011-12-21 Thread robert rottermann
the string you are generating must be proper sql. to test is you migth print it and try in directly against the db. but what you show us is for sure no valid sql. In sql the equality operator is not '==' but '='. robert On 22/12/11 06:34, Sana klh wrote: I am getting the following error

[sqlalchemy] Postgres: autoincremet sequence do not work after upgrade to sql 7.2

2011-09-03 Thread robert rottermann
Hi there, after Upgrading sqlalchemy to V 0.7.x i get the following error Traceback (innermost last): Module ZPublisher.Publish, line 126, in publish Module ZPublisher.mapply, line 77, in mapply Module ZPublisher.Publish, line 46, in call_object Module wrapper, line 5, in wrapper

[sqlalchemy] question re using the session object

2011-06-14 Thread robert rottermann
hi there, for a zope website I am using sqlalchemy. Now I am unsure how to use the session object. What I do now is: from sqlalchemy.orm import scoped_session ... Session = scoped_session(session_factory, scopefunc) session = Session() this session object I import into all classes where ever I

[sqlalchemy] SystemError: null argument to internal routine

2011-03-11 Thread robert rottermann
Hi there, when testing one of my routines I get a strange error. SystemError: null argument to internal routine this is the method I call: def getExistingDoktypes(self, typid=0): return tuple with ((typid, typ), ((typid1, typ1), (typid2, typ2), ..)) session =

Re: [sqlalchemy] SystemError: null argument to internal routine

2011-03-11 Thread robert rottermann
this was caused by some error erlier error that somehow messed up the test environment. thanks for listening robert Am 11.03.2011 10:23, schrieb robert rottermann: Hi there, when testing one of my routines I get a strange error. SystemError: null argument to internal routine

[sqlalchemy] get_col_spec behavior has changed from 0.5.8 to 0.6.X

2010-08-13 Thread robert rottermann
hi there, up to now I did use something like: c = tblCompany.__table__.columns COMPANY_FIELDS = [(k, c[k].type.get_col_spec()) for k in c.keys() if not k=='id'] to build some dynamic forms for a web application. now this breaks with an error: AttributeError: 'VARCHAR' object has no

[sqlalchemy] error:Could not determine relationship direction for primaryjoin condition

2010-07-29 Thread robert rottermann
hi there i get an error: Could not determine relationship direction for primaryjoin condition 'cisdata.`ID_cis` = cisbr.`ID_cisbr`', on relationship Branchen.branche. Do the columns in 'foreign_keys' represent only the 'foreign' columns in this join condition ? when I use the following

[sqlalchemy] how to use primary/secondary join when there are no foreign keys

2010-07-29 Thread robert rottermann
hi there I would like to define a m:n relation between two tables that are linked by an association table. I am using MySQL 5.1 and SA 0.6.3 this is the select that I want to implement: select * from cisdata c, cisbr cb branchen b, where c.ID_cis = cb.ID_cisbr and cb.ID_br

[sqlalchemy] relation does not honor order_by attribute

2009-10-14 Thread robert rottermann
hi there, I am using a one to many relation, and would like the result to be ordered by a field of the child table. however no order by statement is executed when I access the related property of the parent object. this is my declaration: mitarbeiter_table = Table('mitarbeiter',

[sqlalchemy] Re: relation does not honor order_by attribute

2009-10-14 Thread robert rottermann
thanks robert Gaetan de Menten schrieb: On Wed, Oct 14, 2009 at 08:34, robert rottermann rob...@redcor.ch wrote: I am using a one to many relation, and would like the result to be ordered by a field of the child table. however no order by statement is executed when I access the related

[sqlalchemy] Re: how to use mysqls SQL_CALC_FOUND_ROWS or how to know what number of rows a query would return.

2009-08-29 Thread robert rottermann
it. is this possible? thanks again robert On Aug 23, 2009, at 4:23 PM, robert rottermann wrote: Hi there, I would like to create a batching functionality for a web based aplication that uses a mysql database. mysql offeres SQL_CALC_FOUND_ROWS for this purpose. how can I use

[sqlalchemy] Re: how to use mysqls SQL_CALC_FOUND_ROWS or how to know what number of rows a query would return.

2009-08-29 Thread robert rottermann
session.query(...).from_statement(q.statement.prefix_with (SQL_CALC_FOUND_ROWS...)) On Aug 29, 2009, at 2:47 AM, robert rottermann wrote: Michael Bayer schrieb: use the prefixes argument to select() for this. thanks very much. it it possible to use this somehow with session.query? I do

[sqlalchemy] how to use mysqls SQL_CALC_FOUND_ROWS or how to know what number of rows a query would return.

2009-08-23 Thread robert rottermann
Hi there, I would like to create a batching functionality for a web based aplication that uses a mysql database. mysql offeres SQL_CALC_FOUND_ROWS for this purpose. how can I use it, or is there a generic way to have sqlalchemy return the number of rows a query would have returned without

[sqlalchemy] Re: how does a class instance find its values

2009-07-25 Thread robert rottermann
Werner F. Bruhin schrieb: Robert, robert rottermann wrote: ... however I would like to change the assignMyselfToCompany method in a way that I could achieve the same with: product = tblProducts_kl() product.assignMyselfToCompany(company_id) Unless you do some more things in your

[sqlalchemy] how does a class instance find its values

2009-07-24 Thread robert rottermann
hi there, how can an instance of a class with a Table bound to it access the values of the values of its db record? what I would like to do is something like the following: class company(Base): __table__ = 'tblCompany' ... def listAssignedProducts(self): print assigned products

[sqlalchemy] can not us backref name twice:why?

2009-05-17 Thread robert rottermann
hi there, I am using sqlalchemy 0.5.3 with the following declaration: # membership class tblMembershiptype(Base2): __table__ = tables2[tblMembershiptype] company_members = relation( tblCompany, secondary=tables2[tblMembership], backref='membershiptyp', )

[sqlalchemy] what attributes are allowed for column_mapped_collection?

2009-02-27 Thread robert rottermann
Hi there, I would like to have a dictionary like collection based on one of the collections provided by sa like attribute_mapped_collection. now my question: May I use id which is autogenerated and primary key as the controlling attribute of the collection like: flagged_companies =

[sqlalchemy] Could not determine join condition between parent/child but foreign keys exist

2009-02-19 Thread robert rottermann
Hi there, i have two tables that are lined trouh association table. now on the developpment box every thing works fine. but on the live db it does not work. insted I get the following error. Could not determine join condition between parent/child tables on relation dokumentCL.verteiler.

[sqlalchemy] Re: Could not determine join condition between parent/child but foreign keys exist

2009-02-19 Thread robert rottermann
here are my mappings and the tbl definition thanks again robert engine_factory = EngineFactory(DSN) #, echo=True) SCOPED_SESSION_NAME = SESSIONNAME engine = engine_factory() Base = declarative_base(engine) Base.metadata.reflect() tables = Base.metadata.tables class verteilerCL(Base):

[sqlalchemy] Re: Could not determine join condition between parent/child but foreign keys exist

2009-02-19 Thread robert rottermann
reflection for that table. this works now. thanks robert On Feb 19, 2009, at 10:37 AM, robert rottermann wrote: here are my mappings and the tbl definition thanks again robert engine_factory = EngineFactory(DSN) #, echo=True) SCOPED_SESSION_NAME = SESSIONNAME engine = engine_factory

[sqlalchemy] question on using not_

2009-01-23 Thread robert rottermann
Hi there, I have a table tblPerson that has a m:n relation with a table tblFlag using an association table tblCompany_has_Flag now I would like to find all persons, that do not have assigned any of list of flags. what I have tried among other things is the following: s =

[sqlalchemy] KeyError: u'oid' when reflecting postgres db

2009-01-19 Thread robert rottermann
hi there, when I try to reflect a postges db like this: Base2 = declarative_base(engine) Base2.metadata.reflect() I get a key error (see below). however, if I define its class using autoload, things are fine class dokstatus(Base2): #__table__ = tables2[dokstatus] __tablename__ =

[sqlalchemy] question re query vs select

2009-01-04 Thread robert rottermann
hi there I have a class tblMembershiptypeTable which I defind using declarative notation now I wold like to issue a query that returns instances of this class session.query(tblMembershiptypeTable).filter_by(name=mtype).all()[0] works as expected. whereas t = tblMembershiptypeTable.__table__ mt

[sqlalchemy] Re: question/problem with relation and autoload

2008-12-30 Thread robert rottermann
found it out myself: related_persons = orm.relation(tblPersonTable, secondary=tblPersonCompanyTable, backref=company) must be related_persons = orm.relation(tblPersonTable, secondary=tblPersonCompanyTable.__table__, backref=company) have a good time robert robert

[sqlalchemy] how do I get an iterator from a query?

2008-12-14 Thread robert rottermann
Hi there, I have a query like: sesion.query(MytableTable) which returns a huge numer of recors. now I would like to iterate trough the records. What method should I use? sesion.query(MytableTable).all() returns all and next or fetchone is not defined. thanks for your help robert

[sqlalchemy] how to write a dirty relation to the db?

2008-11-21 Thread robert rottermann
Hi there, I try to grasp relations .. I have an m:n association between two tables. this is what I do: engine = sa.create_engine('mysql://[EMAIL PROTECTED]/energie_2', echo=True) Session = sessionmaker(bind=engine) session = Session() this is what I have: tblPersonTable and tblSupplierTable

[sqlalchemy] Re: how to write a dirty relation to the db?

2008-11-21 Thread robert rottermann
found it out myself. a commit was missing thanks for your time robert robert rottermann schrieb: Hi there, I try to grasp relations .. I have an m:n association between two tables. this is what I do: engine = sa.create_engine('mysql://[EMAIL PROTECTED]/energie_2', echo=True) Session

[sqlalchemy] how to dynamically creating and_ clause

2008-10-07 Thread robert rottermann
hi there, I would like to add entries to an and_ clause dinamycally like: and_clause = and_() if x: add sommething to and_clause if y: add sommething to and_clause .. how would I do that thanks robert --~--~-~--~~~---~--~~ You received this message because

[sqlalchemy] Re: 64-bit postgres produces: This SchemaItem is not connected to any Engine

2008-05-21 Thread robert rottermann
jason kirtland schrieb: robert rottermann wrote: thanks jason, jason kirtland schrieb: robert rottermann wrote: Hi there, I am building a zope/plone site that uses sqlalchemy (collective.lead). on two systems I am developping on everything works fine, a third one

[sqlalchemy] 64-bit postgres produces: This SchemaItem is not connected to any Engine

2008-05-20 Thread robert rottermann
Hi there, I am building a zope/plone site that uses sqlalchemy (collective.lead). on two systems I am developping on everything works fine, a third one that has 64 bit linux installed (all systems use SuSE 10.3) I get an traceback: Module ruagaero.intradevcontent.db.db, line 22, in

[sqlalchemy] Re: 64-bit postgres produces: This SchemaItem is not connected to any Engine

2008-05-20 Thread robert rottermann
thanks jason, jason kirtland schrieb: robert rottermann wrote: Hi there, I am building a zope/plone site that uses sqlalchemy (collective.lead). on two systems I am developping on everything works fine, a third one that has 64 bit linux installed (all systems use SuSE 10.3) I get

[sqlalchemy] Re: how to assign values to columns of a mapper?

2006-12-18 Thread robert rottermann
Michael Bayer wrote: the error message indicates that there is more than one Session in play. a big reason for this is that people have import sqlalchemy.ext.threadlocal lying around when they dont really want that. thanks for the hint, I do not use threadlocal in any direct way but I am

[sqlalchemy] how to assign values to columns of a mapper?

2006-12-16 Thread robert rottermann
I would like to read data from aa Excel-sheet to this goal I have created a mapper using: from sqlalchemy.ext.sqlsoup import class_for_table columns = construct_columns_from_excel table = Table(self.tblname, self.metadata, *columns) .. mapper = sqlalchemy.ext.sqlsoup(table) now I would like

[sqlalchemy] Re: loosing selected database with mysql

2006-12-07 Thread robert rottermann
what I meant is that I use use XYZ from python code .. robert --~--~-~--~~~---~--~~ 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] loosing selected database with mysql

2006-12-06 Thread robert rottermann
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 hi there, I am creating a tool that should add data from an excel sheet into mysql. i am using sqlalchmy 0.3 I want to be able to set the database in mysql at runtime. what I do is sommething allong the following lines: connectionstr =

[sqlalchemy] Re: how to remove table from an engine

2006-11-05 Thread robert rottermann
Michael Bayer wrote: create a new, empty MetaData instance. redefine=True didnt work so great since tables have dependencies on each other. thanks for the answer, I just saw that redefine is still in the docstring for 0.3s Table class. robert

[sqlalchemy] how to select a database with MySQL

2006-11-05 Thread robert rottermann
hi there, i want to create a database in mysql and then use it. this is what I do: in the __init__ def __init__( self, connectionstr ): self.connectionstr = connectionstr def _checkEngine(self): if self._db_engine is None: self._db_engine =

[sqlalchemy] how to redefine a table object

2006-11-01 Thread robert rottermann
hi there, I am new to SA. For a tool I am creating I am also writing unittests. In these I recreate the same table object repeatedly. Up to now (with 0.28) this worked fine when I added redefine=True. In 0.3 this does not work anymore. How would I remove/update a table from from a MetaData