[sqlalchemy] Re: Read only connection with Table reflection

2007-08-29 Thread shday


 Is there any way to use reflection with a read only connection?


I use reflection on an Oracle database with read only permission, no
problems (using SA 0.3.8).

I don't recall seeing SA trying to do a ROLLBACK during reflection
though.

Steve


--~--~-~--~~~---~--~~
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: Read only connection with Table reflection

2007-08-29 Thread Michael Bayer


On Aug 29, 2007, at 1:55 PM, Jason Koelker wrote:

 I am attempting to use SQLAlchemy's table reflection to access a MSSQL
 2k database.  However the user I can connect with only had
 db_datareader access.  When SQLAlchemy tries to load the schema, it
 attempts a rollback at the end, which the user does not have
 permission to execute:


 Is there any way to use reflection with a read only connection?


ive never heard of a DB connection where the user doesnt have  
ROLLBACK permission (considering any transaction is local to that  
user anyway !?).  theres no write operations occuring during a  
reflection otherwise.

While i'll accept tickets/patches to get a dont_issue_rollbacks  
create_engine() flag going, most expedient in your case would be to  
allow your user at least the ability to issue a ROLLBACK.

--~--~-~--~~~---~--~~
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: Read only connection with Table reflection

2007-08-29 Thread Jason Koelker

On Aug 29, 7:27 pm, Michael Bayer [EMAIL PROTECTED] wrote:
 On Aug 29, 2007, at 1:55 PM, Jason Koelker wrote:

  I am attempting to use SQLAlchemy's table reflection to access a MSSQL
  2k database.  However the user I can connect with only had
  db_datareader access.  When SQLAlchemy tries to load the schema, it
  attempts a rollback at the end, which the user does not have
  permission to execute:

  Is there any way to use reflection with a read only connection?

 ive never heard of a DB connection where the user doesnt have
 ROLLBACK permission (considering any transaction is local to that
 user anyway !?).  theres no write operations occuring during a
 reflection otherwise.


Chalk that up to my inability to administrate windows/mssql. ;)

 While i'll accept tickets/patches to get a dont_issue_rollbacks
 create_engine() flag going, most expedient in your case would be to
 allow your user at least the ability to issue a ROLLBACK.

Roger, I'll figure out how to give just that permissions to the user.

On a side note I did have to change the way SQLAlchemy was passing
the port to the pyodbc library for FreeTDS to be happy.  Instead of:

if 'port' in keys:
connectors.append('Server=%s,%d' % (keys.get('host'),
keys.get('port')))
else:
connectors.append('Server=%s' % keys.get('host'))

What worked for me is:

if 'port' in keys:
connectors.append('Port=%d' % keys.get('port'))
connectors.append('Server=%s' % keys.get('host'))

I looked on technet it looks like the comma syntax is an ado/windows
thing.

Happy Hacking!

7-11


--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---