On Apr 4, 2011, at 9:07 PM, Harish Tejwani wrote:

> We are trying to point SQLAlchemny (0.6.5 engine) to use custom MySQL
> Socket using URL Parameter as below
> 
> 
> WRITEDATASTORE = topsight_config.DATASTORE + '?unix_socket=/opt/mysql/
> mysql.sock'
> 
> writeengine = create_engine(WRITEDATASTORE,
> echo=topsight_config.SQL_DEBUG, pool_recycle=3600)
> 
> However this does not seem to work always. The application does work,
> however for many queries we get the following error in Log File
> 
> Why is engine defaulting to /var/lib/mysql/mysql.sock? Is there
> another way to set this value while creating the Egine

That's the correct way to set the value and it works.    SQLAlchemy knows 
nothing about this parameter and it is passed straight through.    If it is not 
"always working", that strongly suggests your application is calling a 
different create_engine() statement elsewhere which is used in some cases.   
I'd grep for it.


> 
> 
> [Mon Apr 04 17:48:02 2011] [error] [client 10.200.22.204] File '/home/
> topsight/code/tsweb/data/templates/status.html.py', line 80 in
> render_body
> [Mon Apr 04 17:48:02 2011] [error] [client 10.200.22.204]   ruleset =
> dict((s[0],s) for s in se.all())
> [Mon Apr 04 17:48:02 2011] [error] [client 10.200.22.204] File '/usr/
> lib/python2.6/site-packages/SQLAlchemy-0.6.5-py2.6.egg/sqlalchemy/orm/
> query.py', line 1576 in all
> [Mon Apr 04 17:48:02 2011] [error] [client 10.200.22.204]   return
> list(self)
> [Mon Apr 04 17:48:02 2011] [error] [client 10.200.22.204] File '/usr/
> lib/python2.6/site-packages/SQLAlchemy-0.6.5-py2.6.egg/sqlalchemy/orm/
> query.py', line 1688 in __iter__
> [Mon Apr 04 17:48:02 2011] [error] [client 10.200.22.204]   return
> self._execute_and_instances(context)
> [Mon Apr 04 17:48:02 2011] [error] [client 10.200.22.204] File '/usr/
> lib/python2.6/site-packages/SQLAlchemy-0.6.5-py2.6.egg/sqlalchemy/orm/
> query.py', line 1693 in _execute_and_instances
> [Mon Apr 04 17:48:02 2011] [error] [client 10.200.22.204]
> mapper=self._mapper_zero_or_none())
> [Mon Apr 04 17:48:02 2011] [error] [client 10.200.22.204] File '/usr/
> lib/python2.6/site-packages/SQLAlchemy-0.6.5-py2.6.egg/sqlalchemy/orm/
> session.py', line 728 in execute
> [Mon Apr 04 17:48:02 2011] [error] [client 10.200.22.204]   return
> self._connection_for_bind(engine, close_with_result=True).execute(
> [Mon Apr 04 17:48:02 2011] [error] [client 10.200.22.204] File '/usr/
> lib/python2.6/site-packages/SQLAlchemy-0.6.5-py2.6.egg/sqlalchemy/orm/
> session.py', line 669 in _connection_for_bind
> [Mon Apr 04 17:48:02 2011] [error] [client 10.200.22.204]   return
> self.transaction._connection_for_bind(engine)
> [Mon Apr 04 17:48:02 2011] [error] [client 10.200.22.204] File '/usr/
> lib/python2.6/site-packages/SQLAlchemy-0.6.5-py2.6.egg/sqlalchemy/orm/
> session.py', line 336 in _connection_for_bind
> [Mon Apr 04 17:48:02 2011] [error] [client 10.200.22.204]   conn =
> bind.contextual_connect()
> [Mon Apr 04 17:48:02 2011] [error] [client 10.200.22.204] File '/usr/
> lib/python2.6/site-packages/SQLAlchemy-0.6.5-py2.6.egg/sqlalchemy/
> engine/base.py', line 1829 in contextual_connect
> [Mon Apr 04 17:48:02 2011] [error] [client 10.200.22.204]
> self.pool.connect(),
> [Mon Apr 04 17:48:02 2011] [error] [client 10.200.22.204] File '/usr/
> lib/python2.6/site-packages/SQLAlchemy-0.6.5-py2.6.egg/sqlalchemy/
> pool.py', line 183 in connect
> [Mon Apr 04 17:48:02 2011] [error] [client 10.200.22.204]   return
> _ConnectionFairy(self).checkout()
> [Mon Apr 04 17:48:02 2011] [error] [client 10.200.22.204] File '/usr/
> lib/python2.6/site-packages/SQLAlchemy-0.6.5-py2.6.egg/sqlalchemy/
> pool.py', line 370 in __init__
> [Mon Apr 04 17:48:02 2011] [error] [client 10.200.22.204]   rec =
> self._connection_record = pool.get()
> [Mon Apr 04 17:48:02 2011] [error] [client 10.200.22.204] File '/usr/
> lib/python2.6/site-packages/SQLAlchemy-0.6.5-py2.6.egg/sqlalchemy/
> pool.py', line 214 in get
> [Mon Apr 04 17:48:02 2011] [error] [client 10.200.22.204]   return
> self.do_get()
> [Mon Apr 04 17:48:02 2011] [error] [client 10.200.22.204] File '/usr/
> lib/python2.6/site-packages/SQLAlchemy-0.6.5-py2.6.egg/sqlalchemy/
> pool.py', line 733 in do_get
> [Mon Apr 04 17:48:02 2011] [error] [client 10.200.22.204]   con =
> self.create_connection()
> [Mon Apr 04 17:48:02 2011] [error] [client 10.200.22.204] File '/usr/
> lib/python2.6/site-packages/SQLAlchemy-0.6.5-py2.6.egg/sqlalchemy/
> pool.py', line 148 in create_connection
> [Mon Apr 04 17:48:02 2011] [error] [client 10.200.22.204]   return
> _ConnectionRecord(self)
> [Mon Apr 04 17:48:02 2011] [error] [client 10.200.22.204] File '/usr/
> lib/python2.6/site-packages/SQLAlchemy-0.6.5-py2.6.egg/sqlalchemy/
> pool.py', line 254 in __init__
> [Mon Apr 04 17:48:02 2011] [error] [client 10.200.22.204]
> self.connection = self.__connect()
> [Mon Apr 04 17:48:02 2011] [error] [client 10.200.22.204] File '/usr/
> lib/python2.6/site-packages/SQLAlchemy-0.6.5-py2.6.egg/sqlalchemy/
> pool.py', line 320 in __connect
> [Mon Apr 04 17:48:02 2011] [error] [client 10.200.22.204]   connection
> = self.__pool._creator()
> [Mon Apr 04 17:48:02 2011] [error] [client 10.200.22.204] File '/usr/
> lib/python2.6/site-packages/SQLAlchemy-0.6.5-py2.6.egg/sqlalchemy/
> engine/strategies.py', line 76 in connect
> [Mon Apr 04 17:48:02 2011] [error] [client 10.200.22.204]   return
> dialect.connect(*cargs, **cparams)
> [Mon Apr 04 17:48:02 2011] [error] [client 10.200.22.204] File '/usr/
> lib/python2.6/site-packages/SQLAlchemy-0.6.5-py2.6.egg/sqlalchemy/
> engine/default.py', line 249 in connect
> [Mon Apr 04 17:48:02 2011] [error] [client 10.200.22.204]   return
> self.dbapi.connect(*cargs, **cparams)
> [Mon Apr 04 17:48:02 2011] [error] [client 10.200.22.204] File 'build/
> bdist.linux-x86_64/egg/MySQLdb/__init__.py', line 81 in Connect
> [Mon Apr 04 17:48:02 2011] [error] [client 10.200.22.204] File 'build/
> bdist.linux-x86_64/egg/MySQLdb/connections.py', line 187 in __init__
> [Mon Apr 04 17:48:02 2011] [error] [client 10.200.22.204]
> OperationalError: (OperationalError) (2002, "Can't connect to local
> MySQL server through socket '/var/lib/mysql/mysql.sock' (2)") None
> None
> [Mon Apr 04 17:48:02 2011] [error] [client 10.200.22.204]
> [Mon Apr 04 17:48:02 2011] [error] [client 10.200.22.204]
> 
> -- 
> 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 
> sqlalchemy+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/sqlalchemy?hl=en.
> 

-- 
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 
sqlalchemy+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en.

Reply via email to