zillow / ctds

Python DB-API 2.0 library for MS SQL Server
MIT License
83 stars 12 forks source link

Connection Pool docs incorrect #61

Closed suederade closed 4 years ago

suederade commented 4 years ago

The docs located here https://zillow.github.io/ctds/pooling.html seem to be incorrect on how to make a connection pool.

Current:

import ctds

pool = ctds.pool.ConnectionPool(
    ctds,
    config
)

This results in this error:

AttributeError: module 'ctds' has no attribute 'pool'

What only works for me is this:

import ctds
from ctds.pool import ConnectionPool

pool = ConnectionPool(
    ctds,
    config
)
joshuahlang commented 4 years ago

Indeed. I'll update the docs ASAP.

suederade commented 4 years ago

@joshuahlang Thanks! Can I ask another quick question around the pools. What actually creates the transaction? I know some of them can use with on the connection to create a transaction (psycopg2), but I'm not sure that works in this case. pymssql I believe makes it on an execute, but I can't seem to find in the docs where a transaction begins.

joshuahlang commented 4 years ago

ctds relies on SQL Server to create the transaction internally, using the IMPLICIT_TRANSACTIONS feature. How this is utilized by ctds is documented here: https://zillow.github.io/ctds/transactions.html

suederade commented 4 years ago

Oh, totally glossed over the documentation to the implicit transactions. My bad and thanks!

joshuahlang commented 4 years ago

Fixed: https://zillow.github.io/ctds/pooling.html