[sqlalchemy] the columns retrieved in a recordset
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 hi friends, could i know the columns a select would retrieve, without examining the first record retrieved? or if no records matched the where. tia , alex -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.6 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iQCVAwUBR5Hxx9pwN1sq38njAQIkGQP/QtdYPK/58VHShiidSO9vVCACFQNNcVae CbyRQjaqhUizKsUY5RDGCjVeaE+xoWQBQ3Xz+mjN4lufwKhw5Lz6AouLP/oNejNa 2gTFCJiQ8VErw+XgctJus2MVJK2W+u3xodVtcqMibc66A6H+PXW5vuJab2zMaoMU RiPQ6KrDsZM= =7tG3 -END PGP SIGNATURE- --~--~-~--~~~---~--~~ 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: msqsql and sqlalchemy on linux -was Re: mssql connection uri
On Jan 17, 2008 4:35 PM, jason kirtland [EMAIL PROTECTED] wrote: I've got a local branch going to formalize the multi-driver support ease using SQLAlchemy on alternate VMs. Adding ODBC to a single-driver dialect in CPython was my step 1, next up is sqlite via JDBC for Jython, and then the same in IronPython. Hi Jason, A while back I took a crack at jdbc support for mysql -- I got as far as connecting and fetching some data with a simple select. See http://www.mail-archive.com/sqlalchemy@googlegroups.com/msg04745.html. I'm getting ready to revive that effort. How far are you on your jdbc experiments? -Frank --~--~-~--~~~---~--~~ 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: Problems connecting to Postgresql using collective.lead
Alex Turner schrieb: I am getting an error connecting to Postgresql: ImportError: unknown database 'psycopg' The back story is that I am attempting to modify an example given in Martin Aspeli's Book: Professional Plone Development (Chapter 12 - page 274-. He recommends using SQLAlchemy, and it looks very cool, kind of similar to a SQLBuilder class I put together a few years ago, but more advanced. I don't know really what to provide as I am completely new to SQLAlchemy, but the most relevent thing that I can see is the class that extends collective.lead.Database and the properties class: from persistent import Persistent from zope.interface import implements from zope.component import getUtility from collective.lead import Database from mls.agent.interfaces import IDatabaseSettings from sqlalchemy.engine.url import URL from sqlalchemy import Table, mapper, relation from mls.agent.person import Person from mls.agent.office import Office class MLSDatabaseSettings(Persistent): Database connection settings We use raw fields here so that we can more easily use a zope.formlib form in the control panel to configure it. This is registered as a persistent local utility, with name 'optilux.reservations', which is then used by collective.lead.interfaces.IDatabase to find connection settings. implements(IDatabaseSettings) drivername = 'psycopg' hostname = 'localhost' port = 5432 username = 'postgres' password = 'postgres' database = 'trend-dev' class MLSDatabase(Database): The reservations database - registered as a utility providing collective.lead.interfaces.IDatabase and named 'optilux.reservations' @property def _url(self): settings = getUtility(IDatabaseSettings) return URL(drivername=settings.drivername, username=settings.username, password=settings.password, host=settings.hostname, port=settings.port, database=settings.database) def _setup_tables(self, metadata, tables): Map the database structure to SQLAlchemy Table objects tables['person'] = Table('person', metadata, autoload=True) tables['office'] = Table('office', metadata, autoload=True) def _setup_mappers(self, tables, mappers): Map the database Tables to SQLAlchemy Mapper objects mappers['person'] = mapper(Person, tables['person'], properties = {'office' : relation(Office),}); mappers['office'] = mapper(Office, tables['office']) Also the test case that I am running: self.loginAsPortalOwner() from zope.component import getUtility from mls.agent.interfaces import IDatabaseSettings settings = getUtility(IDatabaseSettings) settings.drivername = 'psycopg' settings.username = 'postgres' settings.password = 'postgres' settings.hostname = 'localhost' settings.database = 'trend-dev' from collective.lead.interfaces import IDatabase db=getUtility(IDatabase, name='db.mls') from mls.agent.interfaces import IPersonLocator locator = getUtility(IPersonLocator) locator.persons_for_mls_person_code(data).last_name; answer As far as I know the drivername for PostgreSQL is postgres and not psycopg2. Look at http://www.sqlalchemy.org/docs/04/dbengine.html#dbengine_establishing Bernhard --~--~-~--~~~---~--~~ 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: Problems connecting to Postgresql using collective.lead
--On 18. Januar 2008 15:56:02 -0800 Alex Turner [EMAIL PROTECTED] wrote: I am getting an error connecting to Postgresql: ImportError: unknown database 'psycopg' The canonical driver name for Postgres databases is 'postgres'. Looks like a typo in Martin's book. psycopg(2) is name of the underlying Python driver for Postgres but it is not part of the DSN. Andreas pgpkKYBlPQyN5.pgp Description: PGP signature
[sqlalchemy] Re: Problems connecting to Postgresql using collective.lead
Ahh - that is the thing - he doesn't say in the book about postgresql, that is sort of the problem! He uses MySQL (Ugh) in the book, so I was sort of guessing. Alex On Jan 19, 2008 11:23 AM, Andreas Jung [EMAIL PROTECTED] wrote: --On 18. Januar 2008 15:56:02 -0800 Alex Turner [EMAIL PROTECTED] wrote: I am getting an error connecting to Postgresql: ImportError: unknown database 'psycopg' The canonical driver name for Postgres databases is 'postgres'. Looks like a typo in Martin's book. psycopg(2) is name of the underlying Python driver for Postgres but it is not part of the DSN. Andreas --~--~-~--~~~---~--~~ 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] A General Thank You
To all the people who have worked on SQL Alchemy's docs. A massive thank you! It is so refreshing to come to an open source project that has not just adequate documentation, but totally awesome docs. I can't believe how fast I was able to get SQL Alchemy working, the docs are fantastic!!! Alex --~--~-~--~~~---~--~~ 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: msqsql and sqlalchemy on linux -was Re: mssql connection uri
Frank Wierzbicki wrote: On Jan 17, 2008 4:35 PM, jason kirtland [EMAIL PROTECTED] wrote: I've got a local branch going to formalize the multi-driver support ease using SQLAlchemy on alternate VMs. Adding ODBC to a single-driver dialect in CPython was my step 1, next up is sqlite via JDBC for Jython, and then the same in IronPython. Hi Jason, A while back I took a crack at jdbc support for mysql -- I got as far as connecting and fetching some data with a simple select. See http://www.mail-archive.com/sqlalchemy@googlegroups.com/msg04745.html. I'm getting ready to revive that effort. How far are you on your jdbc experiments? Hi Frank, I'm not too far yet with Jython- still working on CPython issues. This weekend I plan to check in a tool that converts the test suite source into 2.3-compatible syntax, enabling testing with the Jython trunk's parser and CPython 2.3. I'm using it locally and just need to polish it up a bit before committing. Some parts of the test suite require SQLite, so that was going to be my initial target once any Jython stdlib issues were ironed out. I've never used SQLite in Java and I'm kind of curious what JDBC will do with the only nominally typed data coming out of a SQLite database... -j --~--~-~--~~~---~--~~ 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: the columns retrieved in a recordset
theoreticaly, looking at the sql.expression.py/Select, try for a in yourselect.inner_columns: print a it's a yielding property. alex bodnaru wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 hi friends, could i know the columns a select would retrieve, without examining the first record retrieved? or if no records matched the where. tia , alex --~--~-~--~~~---~--~~ 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: the columns retrieved in a recordset
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 thanks for your answer. i just wonder whether the * (all columns) is being expanded there. alex [EMAIL PROTECTED] wrote: theoreticaly, looking at the sql.expression.py/Select, try for a in yourselect.inner_columns: print a it's a yielding property. alex bodnaru wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 hi friends, could i know the columns a select would retrieve, without examining the first record retrieved? or if no records matched the where. tia , alex -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.6 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iQCVAwUBR5JfrNpwN1sq38njAQJ+gwQAqkvp2a2+9y6lq0tOfiGr6KcXAZ78NJi0 YzMdMgpgFC7kRHbqEydDg1OW8O1i+FvW75fMvFZm1bqi10A7faJEqx8TUrBJOOdw 97oGDshxUEWlB9XB2+k1c32TPlIgQaBYdNaOPUDTuulyUullIFPbv9aYUvYSlm4I pRws955+d1U= =Fw/H -END PGP SIGNATURE- --~--~-~--~~~---~--~~ 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: the columns retrieved in a recordset
i just wonder whether the * (all columns) is being expanded there. try? [EMAIL PROTECTED] wrote: theoreticaly, looking at the sql.expression.py/Select, try for a in yourselect.inner_columns: print a it's a yielding property. alex bodnaru wrote: could i know the columns a select would retrieve, without examining the first record retrieved? or if no records matched the where. tia , alex --~--~-~--~~~---~--~~ 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: msqsql and sqlalchemy on linux -was Re: mssql connection uri
On Jan 19, 2008 1:00 PM, jason kirtland [EMAIL PROTECTED] wrote: Frank Wierzbicki wrote: I'm not too far yet with Jython- still working on CPython issues. This weekend I plan to check in a tool that converts the test suite source into 2.3-compatible syntax, enabling testing with the Jython trunk's parser and CPython 2.3. I'm using it locally and just need to polish it up a bit before committing. Ah you must be jek -- we met on #turbogears the other day. I'm looking forward to seeing and using that tool :) Some parts of the test suite require SQLite, so that was going to be my initial target once any Jython stdlib issues were ironed out. I've never used SQLite in Java and I'm kind of curious what JDBC will do with the only nominally typed data coming out of a SQLite database... I see -- that will be interesting. If it turns out badly it might be worth looking into some Java specific lightweight databases like derby or hssql. -Frank --~--~-~--~~~---~--~~ 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: the columns retrieved in a recordset
On Jan 19, 2008, at 7:49 AM, alex bodnaru wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 hi friends, could i know the columns a select would retrieve, without examining the first record retrieved? or if no records matched the where. result.keys() this returns you string names. if you have a select(), you can get the cols without even executing by saying someselect.c.keys(), or you can get the Column objects by saying list(someselect.c). --~--~-~--~~~---~--~~ 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: the columns retrieved in a recordset
On Jan 19, 2008, at 4:50 PM, Michael Bayer wrote: result.keys() oh its a propresult.keys --~--~-~--~~~---~--~~ 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: the columns retrieved in a recordset
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 thanks a lot, mike and sdobrev :) Michael Bayer wrote: On Jan 19, 2008, at 4:50 PM, Michael Bayer wrote: result.keys() oh its a propresult.keys -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.6 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iQCVAwUBR5J6B9pwN1sq38njAQKjjAQAtPM6Og2DB1lnnAgi1eh50LVdcQmC2M+P lIaj+GGYFwf2z4phVi09mVBiieZtGvZhe+XwcUbhG5iou6b7AqoIh/zUu1gza63D MbWnI2DmdpBAU1WTiVGg9i8IEjxAObWRtmbb6dgIfv/sRd1N4/eqszX0F6/1QnW0 asdgKwQ3z6s= =lbwT -END PGP SIGNATURE- --~--~-~--~~~---~--~~ 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: A General Thank You
youre very welcome ! glad you've had a positive experience. On Jan 19, 2008, at 12:28 PM, Alex Turner wrote: To all the people who have worked on SQL Alchemy's docs. A massive thank you! It is so refreshing to come to an open source project that has not just adequate documentation, but totally awesome docs. I can't believe how fast I was able to get SQL Alchemy working, the docs are fantastic!!! Alex --~--~-~--~~~---~--~~ 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: msqsql and sqlalchemy on linux -was Re: mssql connection uri
Frank Wierzbicki wrote: On Jan 19, 2008 1:00 PM, jason kirtland [EMAIL PROTECTED] wrote: Frank Wierzbicki wrote: I'm not too far yet with Jython- still working on CPython issues. This weekend I plan to check in a tool that converts the test suite source into 2.3-compatible syntax, enabling testing with the Jython trunk's parser and CPython 2.3. I'm using it locally and just need to polish it up a bit before committing. Ah you must be jek -- we met on #turbogears the other day. I'm looking forward to seeing and using that tool :) I just added it to trunk in r4072 and the transform is also easily extractable can be run independently. Nothing too fancy, just rewrites @decorators for 2.3. No generator transforms. For use in SA, there's a new test/clone.py that creates and maintains a 2.3-transformed copy of the test suite. In my workflow, I edit the canonical test sources and then use the tool to pull those updates over, transformed, into my 2.3 sandbox. There's still some more work needed for the test suite to run cleanly on CPython 2.3, seems mostly because of differences between 2.3's sets.Set and 2.4+ builtin sets. -j --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---