Carl Karsten wrote:
> Ed Leafe wrote:
>> On Mar 18, 2007, at 9:08 PM, Carl Karsten wrote:
>>
>>> how is that not a custom cursor class?
>>      It is.
>>
>>> I am not really seeing a difference between what I described and  
>>> what you
>>> described, other than there is a bit of implementation detail that  
>>> I don't
>>> understand:  sounds like the re-define happens at run time - why  
>>> not do that at
>>> design time?
>>      I don't understand the distinction. You have a user logging in. User  
>> A has accesss to certain databasess; User B has access to others. How  
>> can you determine this at design time, and not at runtime?
>>
> 
> I can't, but what does user rights have to do with what you were saying 
> should 
> be re-defined?
> 
> I am roughing out the code that will get the list of db's now.  maybe that 
> will 
> clear things up.
> 


import MySQLdb

con = MySQLdb.connect(host='localhost', user='foo', passwd='bar' )
cur=con.cursor()

cSql="""
select distinct TABLE_SCHEMA
  from information_schema.SCHEMA_PRIVILEGES
  where GRANTEE like %(user)s
"""
cur.execute( cSql, { 'user':'%foo%' } )

rows = cur.fetchall()
print rows


I should not have named both the db and the user foo.  doh.
time to eat dinner now...

Carl K

_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/dabo-users

Reply via email to