yes, don't call creator(), just pass the callable

create_engine("...", creator=creator)



On 06/07/2016 01:34 PM, Brad Hudson wrote:
I have fixed my original issue which turned out to be that python
(64-bit) was trying to call a non-existant 64-bit driver and choking on
the 32-bit version. I re-installed anaconda 3.4 (32-bit) and now have a
different issue. Can someone help with this one?

    Python 3.5.1 |Continuum Analytics, Inc.| (default, Mar  4 2016,
    15:28:01) [MSC v.1900 32 bit (Intel)] on win32
    Type "help", "copyright", "credits" or "license" for more information.
    >>> import pyodbc
    >>> from sqlalchemy.ext.automap import automap_base
    >>> from sqlalchemy.orm import Session
    >>> from sqlalchemy import create_engine
    >>>
    >>> Base = automap_base()
    >>> def creator():
    ...   return pyodbc.connect('driver={Adaptive Server
    
Enterprise};dsn=SYBDSN;uid=user;pwd=passw;server=mhost.domain.com;port=8001')
    ...
    >>> eng = create_engine('sybase+pyodbc://', creator=creator())
    >>> print(eng.echo)
    None
    >>> eng.echo = True
    >>> print(eng.echo)
    True
    >>> Base.prepare(eng, reflect=True)
    Traceback (most recent call last):
      File
    "C:\brad\Anaconda3\envs\db-app\lib\site-packages\sqlalchemy\pool.py", line
    1044, in _do_get
        return self._pool.get(wait, self._timeout)
      File
    "C:\brad\Anaconda3\envs\db-app\lib\site-packages\sqlalchemy\util\queue.py",
    line 145, in get
        raise Empty
    sqlalchemy.util.queue.Empty

    During handling of the above exception, another exception occurred:

    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
      File
    "C:\brad\Anaconda3\envs\db-app\lib\site-packages\sqlalchemy\ext\automap.py",
    line 743, in prepare
        autoload_replace=False
      File
    "C:\brad\Anaconda3\envs\db-app\lib\site-packages\sqlalchemy\sql\schema.py",
    line 3602, in reflect
        with bind.connect() as conn:
      File
    "C:\brad\Anaconda3\envs\db-app\lib\site-packages\sqlalchemy\engine\base.py",
    line 2018, in connect
        return self._connection_cls(self, **kwargs)
      File
    "C:\brad\Anaconda3\envs\db-app\lib\site-packages\sqlalchemy\engine\base.py",
    line 72, in __init__
        if connection is not None else engine.raw_connection()
      File
    "C:\brad\Anaconda3\envs\db-app\lib\site-packages\sqlalchemy\engine\base.py",
    line 2104, in raw_connection
        self.pool.unique_connection, _connection)
      File
    "C:\brad\Anaconda3\envs\db-app\lib\site-packages\sqlalchemy\engine\base.py",
    line 2074, in _wrap_pool_connect
        return fn()
      File
    "C:\brad\Anaconda3\envs\db-app\lib\site-packages\sqlalchemy\pool.py", line
    318, in unique_connection
        return _ConnectionFairy._checkout(self)
      File
    "C:\brad\Anaconda3\envs\db-app\lib\site-packages\sqlalchemy\pool.py", line
    713, in _checkout
        fairy = _ConnectionRecord.checkout(pool)
      File
    "C:\brad\Anaconda3\envs\db-app\lib\site-packages\sqlalchemy\pool.py", line
    480, in checkout
        rec = pool._do_get()
      File
    "C:\brad\Anaconda3\envs\db-app\lib\site-packages\sqlalchemy\pool.py", line
    1060, in _do_get
        self._dec_overflow()
      File
    
"C:\brad\Anaconda3\envs\db-app\lib\site-packages\sqlalchemy\util\langhelpers.py",
    line 60, in __exit__
        compat.reraise(exc_type, exc_value, exc_tb)
      File
    "C:\brad\Anaconda3\envs\db-app\lib\site-packages\sqlalchemy\util\compat.py",
    line 186, in reraise
        raise value
      File
    "C:\brad\Anaconda3\envs\db-app\lib\site-packages\sqlalchemy\pool.py", line
    1057, in _do_get
        return self._create_connection()
      File
    "C:\brad\Anaconda3\envs\db-app\lib\site-packages\sqlalchemy\pool.py", line
    323, in _create_connection
        return _ConnectionRecord(self)
      File
    "C:\brad\Anaconda3\envs\db-app\lib\site-packages\sqlalchemy\pool.py", line
    449, in __init__
        self.connection = self.__connect()
      File
    "C:\brad\Anaconda3\envs\db-app\lib\site-packages\sqlalchemy\pool.py", line
    607, in __connect
        connection = self.__pool._invoke_creator(self)
      File
    "C:\brad\Anaconda3\envs\db-app\lib\site-packages\sqlalchemy\pool.py", line
    270, in <lambda>
        return lambda crec: creator()
    TypeError: 'pyodbc.Connection' object is not callable
    >>>


On Friday, June 3, 2016 at 4:09:50 PM UTC-5, Mike Bayer wrote:

    you have a FreeTDS problem at this point and you need to contact
    them at
    http://lists.ibiblio.org/mailman/listinfo/freetds
    <http://lists.ibiblio.org/mailman/listinfo/freetds> for further help.

--
You received this message because you are subscribed to the Google
Groups "sqlalchemy" group.
To unsubscribe from this group and stop receiving emails from it, send
an email to [email protected]
<mailto:[email protected]>.
To post to this group, send email to [email protected]
<mailto:[email protected]>.
Visit this group at https://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.

Reply via email to