[sqlalchemy] Re: Access to AS/400 data
On Fri, May 16, 2008 at 3:18 PM, Carlos Hanson [EMAIL PROTECTED] wrote: On Fri, May 16, 2008 at 10:49 AM, Jim Steil [EMAIL PROTECTED] wrote: Carlos Hanson wrote: On Fri, May 16, 2008 at 8:14 AM, Michael Bayer [EMAIL PROTECTED] wrote: On May 16, 2008, at 10:55 AM, Carlos Hanson wrote: On Fri, May 16, 2008 at 6:13 AM, Jim Steil [EMAIL PROTECTED] wrote: Hi: Can anyone tell me if it is possible to access data on an AS/400 through SQLAlchemy? -Jim It's possible if you use db2 connect to make your connection to the iSeries. See http://code.google.com/p/ibm-db/. The support group is [EMAIL PROTECTED] Right now, the as/400 is listed as a Future supported database [1], but there have been some reports from people getting it working. You might want to make your needs known on the support list also follow up with your IBM rep. [1] http://code.google.com/p/ibm-db/wiki/README I'm connecting to an AS/400 using pyodbc, so I am sure that I can do it through SQLAlchemy. If I have a chances to test it, I'll post my success. But if you get an ODBC connection set up, the re should be no problem. well, connecting is just the beginning. to take advantage of SQLA, you would also want an AS/400 dialect that knows how to render SQL in the way an AS/400 likes. Im not familiar with anyone working on an AS/ 400 dialect at the moment. I only know of the DB2 dialect which is a separate project (but maybe ask on their list since they work for IBM). This is a good point. I have to create aliases to a file/member combination to select data. I guess I wouldn't expect SQLAlchemy to implement that by default, since most every other database uses tables. Right... but there's no reason you can't drop down to the db-api level for one-off things like partitioning data with members. Once the alias is created, it can be treated like any other table. -ken --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en -~--~~~~--~~--~--~---
[sqlalchemy] django + sqlalchemy = ?
Cross-posted to django sqlalchemy lists What is the state of SQLAlchemy integration with Django? I saw somewhere that it was possible to use them together, but the author didn't provide any details, and the SQLAlchemy branch of Django hasn't had any commits since late last year. Was the original goal of the branch [1] too aggressive? Thanks in advance. -Ken [1] Integrating Django and SQLAlchemy, Aug 29, 2006: http://groups.google.com/group/django-developers/browse_thread/thread/5149e1c60dc65bff --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en -~--~~~~--~~--~--~---
[sqlalchemy] Re: save_or_update() with a unique but not primary key
Perhaps he's looking for an upsert function? That's sometimes handy, and to be truly useful would have to be able to use any given key on the table. I hacked up an upsert for SQLObject once, but it was so ugly I never contributed it. It did make the poor man's replication system that I was working on simpler, though. On 3/13/07, Michael Bayer [EMAIL PROTECTED] wrote: save_or_update() doesnt take any kind of primary key or unique key argument. no specification of anything is needed. Sean Davis wrote: On Tuesday 13 March 2007 07:35, Sean Davis wrote: We are creating a database that will have a set of autoincrement primary keys on the tables. However, many of the tables also have one or more unique keys associated with them. Can we use save_or_update() (and, by extension, cascade='save_or_update', etc.) by specifying one of the unique keys rather than specifying the primary key directly? Tried it. Looks like not. Sorry for the noise on the list. Sean --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en -~--~~~~--~~--~--~---
[sqlalchemy] assign_mapper breaks polymorphic multi-table inheritance in 3.1?
I'm trying to use assign_mapper with polymorphic multiple table inheritance, and running into problems with the primary key sequencing. Is this a supported use of sqlalchemy? I'm running version 0.3.1. Sample code below. If use_assign_mapper is false, then the script works with both postgres sqlite. If it's true, then sqlite fails on the assertion that the manager employee id's be different, and postgres throws an exception that 'managers_person_id_seq does not exist' Thanks in advance for any help, and thanks for an otherwise awesome product! -Ken #!/usr/bin/env python # The setup here is identical to the example at: # http://sqlalchemy.org/docs/adv_datamapping.myt#advdatamapping_inheritance_multiple # Except that it conditionally uses assignmapper instead of the default mapper from sqlalchemy import * from sqlalchemy.ext.assignmapper import assign_mapper from sqlalchemy.ext.sessioncontext import SessionContext use_postgres = False use_assign_mapper = True if not use_postgres: url = 'sqlite:///:memory:' else: url=postgres://ken:[EMAIL PROTECTED]/tutorial engine = create_engine(url) metadata = BoundMetaData(engine) context = SessionContext(create_session) employees = Table('employees', metadata, Column('person_id', Integer, primary_key=True), Column('name', String(50)), Column('type', String(30))) engineers = Table('engineers', metadata, Column('person_id', Integer, ForeignKey('employees.person_id'), primary_key=True), Column('engineer_info', String(50)), ) managers = Table('managers', metadata, Column('person_id', Integer, ForeignKey('employees.person_id'), primary_key=True), Column('manager_data', String(50)), ) class Employee(object): pass class Engineer(Employee): pass class Manager(Employee): pass person_join = polymorphic_union( { 'engineer':employees.join(engineers), 'manager':employees.join(managers), 'person':employees.select(employees.c.type=='person'), }, None, 'pjoin') metadata.create_all() ### if not use_assign_mapper: #This works: person_mapper = mapper(Employee, employees, select_table=person_join, polymorphic_on=person_join.c.type, polymorphic_identity='person') mapper(Engineer, engineers, inherits=person_mapper, polymorphic_identity='engineer') mapper(Manager, managers, inherits=person_mapper, polymorphic_identity='manager') else: #This doesn't person_mapper = assign_mapper(context, Employee, employees, select_table=person_join, polymorphic_on=person_join.c.type, polymorphic_identity='person') assign_mapper(context, Engineer, engineers, inherits=person_mapper, polymorphic_identity='engineer') assign_mapper(context, Manager, managers, inherits=person_mapper, polymorphic_identity='manager') context.current.echo_uow=True eng = Engineer() mgr = Manager() context.current.save(eng) context.current.save(mgr) context.current.flush() print eng: %d mgr: %d % (eng.person_id, mgr.person_id) assert(eng.person_id != mgr.person_id) --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en -~--~~~~--~~--~--~---