sqlalchemy-tickets Mailing List for SQLAlchemy (Page 68)
Brought to you by:
zzzeek
You can subscribe to this list here.
| 2006 |
Jan
|
Feb
|
Mar
(174) |
Apr
(50) |
May
(71) |
Jun
(129) |
Jul
(113) |
Aug
(141) |
Sep
(82) |
Oct
(142) |
Nov
(97) |
Dec
(72) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2007 |
Jan
(159) |
Feb
(213) |
Mar
(156) |
Apr
(151) |
May
(58) |
Jun
(166) |
Jul
(296) |
Aug
(198) |
Sep
(89) |
Oct
(133) |
Nov
(150) |
Dec
(122) |
| 2008 |
Jan
(144) |
Feb
(65) |
Mar
(71) |
Apr
(69) |
May
(143) |
Jun
(111) |
Jul
(113) |
Aug
(159) |
Sep
(81) |
Oct
(135) |
Nov
(107) |
Dec
(200) |
| 2009 |
Jan
(168) |
Feb
(109) |
Mar
(141) |
Apr
(128) |
May
(119) |
Jun
(132) |
Jul
(136) |
Aug
(154) |
Sep
(151) |
Oct
(181) |
Nov
(223) |
Dec
(169) |
| 2010 |
Jan
(103) |
Feb
(209) |
Mar
(201) |
Apr
(183) |
May
(134) |
Jun
(113) |
Jul
(110) |
Aug
(159) |
Sep
(138) |
Oct
(96) |
Nov
(116) |
Dec
(94) |
| 2011 |
Jan
(97) |
Feb
(188) |
Mar
(157) |
Apr
(158) |
May
(118) |
Jun
(102) |
Jul
(137) |
Aug
(113) |
Sep
(104) |
Oct
(108) |
Nov
(91) |
Dec
(162) |
| 2012 |
Jan
(189) |
Feb
(136) |
Mar
(153) |
Apr
(142) |
May
(90) |
Jun
(141) |
Jul
(67) |
Aug
(77) |
Sep
(113) |
Oct
(68) |
Nov
(101) |
Dec
(122) |
| 2013 |
Jan
(60) |
Feb
(77) |
Mar
(77) |
Apr
(129) |
May
(189) |
Jun
(155) |
Jul
(106) |
Aug
(123) |
Sep
(53) |
Oct
(142) |
Nov
(78) |
Dec
(102) |
| 2014 |
Jan
(143) |
Feb
(93) |
Mar
(35) |
Apr
(26) |
May
(27) |
Jun
(41) |
Jul
(45) |
Aug
(27) |
Sep
(37) |
Oct
(24) |
Nov
(22) |
Dec
(20) |
| 2015 |
Jan
(17) |
Feb
(15) |
Mar
(34) |
Apr
(55) |
May
(33) |
Jun
(31) |
Jul
(27) |
Aug
(17) |
Sep
(22) |
Oct
(26) |
Nov
(27) |
Dec
(22) |
| 2016 |
Jan
(20) |
Feb
(24) |
Mar
(23) |
Apr
(13) |
May
(17) |
Jun
(14) |
Jul
(31) |
Aug
(23) |
Sep
(24) |
Oct
(31) |
Nov
(23) |
Dec
(16) |
| 2017 |
Jan
(24) |
Feb
(20) |
Mar
(27) |
Apr
(24) |
May
(28) |
Jun
(18) |
Jul
(18) |
Aug
(23) |
Sep
(30) |
Oct
(17) |
Nov
(12) |
Dec
(12) |
| 2018 |
Jan
(27) |
Feb
(23) |
Mar
(13) |
Apr
(19) |
May
(21) |
Jun
(29) |
Jul
(11) |
Aug
(22) |
Sep
(14) |
Oct
(9) |
Nov
(24) |
Dec
|
|
From: sqlalchemy <mi...@zz...> - 2013-12-06 19:16:00
|
#2880: handle case where arbitrary connection is hanging on connect, allow others
to go through
---------------------+------------------------------------
Reporter: zzzeek | Owner: zzzeek
Type: defect | Status: new
Priority: highest | Milestone: 0.9.0
Component: pool | Severity: major - 1-3 hours
Keywords: | Progress State: in progress
---------------------+------------------------------------
patch:
{{{
#!diff
diff --git a/lib/sqlalchemy/pool.py b/lib/sqlalchemy/pool.py
index 34681ef..219a98f 100644
--- a/lib/sqlalchemy/pool.py
+++ b/lib/sqlalchemy/pool.py
@@ -812,11 +812,14 @@ class QueuePool(Pool):
self._overflow >= self._max_overflow:
return self._do_get()
else:
- con = self._create_connection()
self._overflow += 1
- return con
finally:
self._overflow_lock.release()
+ try:
+ return self._create_connection()
+ except:
+ self._overflow -= 1
+ raise
def recreate(self):
self.logger.info("Pool recreating")
}}}
heres's a test:
{{{
#!python
from sqlalchemy.pool import QueuePool
from sqlalchemy.testing.mock import Mock, call
import threading
import time
dbapi = Mock()
def hanging_dbapi():
time.sleep(5)
return dbapi.connect()
def fast_dbapi():
return dbapi.connect()
def failing_dbapi():
time.sleep(5)
raise Exception("connection failed")
creator = threading.local()
def create():
return creator.mock_connector()
def run_test(name, should_hang, should_fail):
print("run test: %s %s %s" % (name, should_hang, should_fail))
if should_fail:
creator.mock_connector = failing_dbapi
elif should_hang:
creator.mock_connector = hanging_dbapi
else:
creator.mock_connector = fast_dbapi
conn = pool.connect()
print("connected: %s" % name)
conn.operation(name)
time.sleep(3)
conn.close()
pool = QueuePool(creator=create, pool_size=2, max_overflow=3)
success_one = threading.Thread(target=run_test, args=("success_one",
False, False))
success_two = threading.Thread(target=run_test, args=("success_two",
False, False))
overflow_one = threading.Thread(target=run_test, args=("overflow_one",
True, False))
overflow_two = threading.Thread(target=run_test, args=("overflow_two",
False, False))
overflow_three = threading.Thread(target=run_test, args=("overflow_three",
False, False))
success_one.start()
time.sleep(.5)
success_two.start()
time.sleep(.5)
overflow_one.start()
time.sleep(.5)
overflow_two.start()
time.sleep(.5)
overflow_three.start()
time.sleep(.5)
overflow_one.join(timeout=10)
assert \
dbapi.connect().operation.mock_calls == \
[call("success_one"), call("success_two"),
call("overflow_two"), call("overflow_three"),
call("overflow_one")],\
dbapi.connect().operation.mock_calls
}}}
this is 0.9.0 but I think we can backport to 0.8.4 as well
--
Ticket URL: <http://www.sqlalchemy.org/trac/ticket/2880>
sqlalchemy <http://www.sqlalchemy.org/>
The Database Toolkit for Python
|
|
From: sqlalchemy <mi...@zz...> - 2013-12-06 00:04:23
|
#2879: MS-SQL: Incorrect syntax near the keyword 'COLLATE'.
-----------------------------------+----------------------------------
Reporter: krysros | Owner: zzzeek
Type: defect | Status: closed
Priority: high | Milestone: 0.9.0
Component: orm | Severity: minor - half an hour
Resolution: fixed | Keywords: collate
Progress State: completed/closed |
-----------------------------------+----------------------------------
Changes (by zzzeek):
* status: new => closed
* resolution: => fixed
* severity: major - 1-3 hours => minor - half an hour
* status_field: needs questions answered => completed/closed
Comment:
rb653fb3a23a0388814d9ab79b884d6
--
Ticket URL: <http://www.sqlalchemy.org/trac/ticket/2879#comment:4>
sqlalchemy <http://www.sqlalchemy.org/>
The Database Toolkit for Python
|
|
From: sqlalchemy <mi...@zz...> - 2013-12-04 20:36:41
|
#2879: MS-SQL: Incorrect syntax near the keyword 'COLLATE'.
-------------------------------------------+-------------------------------
Reporter: krysros | Owner: zzzeek
Type: defect | Status: new
Priority: high | Milestone: 0.9.0
Component: orm | Severity: major - 1-3 hours
Resolution: | Keywords: collate
Progress State: needs questions answered |
-------------------------------------------+-------------------------------
Comment (by zzzeek):
it seems like COLLATE following the expression in WHERE without the parens
is normal. PG's docs have some examples:
{{{
SELECT a < ('foo' COLLATE "fr_FR") FROM test1;
SELECT a < b COLLATE "de_DE" FROM test1;
SELECT a COLLATE "de_DE" < b FROM test1;
}}}
from the above it seems like COLLATE has a lower priority than a
comparison operator like <.
Running these tests using first 4 then 7 for priority:
{{{
#!python
from sqlalchemy.sql import column
print (column('x') > column('y')).collate('q')
print (column('x') > column('y').collate('q'))
print (column('x').collate('q') > column('y'))
print (column('x') > column('y')).collate('q') & (column('z') <
column('j')).collate('p')
}}}
output using 4:
{{{
#!sql
x > y COLLATE q
x > (y COLLATE q)
(x COLLATE q) > y
x > y COLLATE q AND z < j COLLATE p
}}}
output using 7
{{{
#!sql
(x > y) COLLATE q
x > y COLLATE q
x COLLATE q > y
(x > y) COLLATE q AND (z < j) COLLATE p
}}}
4 seems to be correct but I'm noticing that using the (x > y.collate(q))
syntax appears to be a workaround, and it's possible this is how we
thought this would work when we first rolled out COLLATE support. It's
likely people are using this form, so I think a change here would have to
be a hard 0.9 thing (more things someone migrating to 0.9 needs to worry
about, basically....)
--
Ticket URL: <http://www.sqlalchemy.org/trac/ticket/2879#comment:3>
sqlalchemy <http://www.sqlalchemy.org/>
The Database Toolkit for Python
|
|
From: sqlalchemy <mi...@zz...> - 2013-12-04 20:25:59
|
#2879: MS-SQL: Incorrect syntax near the keyword 'COLLATE'.
-------------------------------------------+-------------------------------
Reporter: krysros | Owner: zzzeek
Type: defect | Status: new
Priority: high | Milestone: 0.9.0
Component: orm | Severity: major - 1-3 hours
Resolution: | Keywords: collate
Progress State: needs questions answered |
-------------------------------------------+-------------------------------
Comment (by krysros):
Thanks. This workaround works for me.
Replying to [comment:1 zzzeek]:
> Well we'd need to consider if a global change to the precedence of
COLLATE is warranted, you can get that now like:
>
> {{{
> from sqlalchemy.sql import operators
> operators._PRECEDENCE[operators.collate] = 4
> }}}
>
> a patch with some unit test changes follows, I'd need to research how
COLLATE is applied on other backends to see if this change is universally
appropriate:
>
> {{{
> #!diff
> diff --git a/lib/sqlalchemy/sql/operators.py
b/lib/sqlalchemy/sql/operators.py
> index 2ccc878..9220cf1 100644
> --- a/lib/sqlalchemy/sql/operators.py
> +++ b/lib/sqlalchemy/sql/operators.py
> @@ -821,7 +821,7 @@ _PRECEDENCE = {
> and_: 3,
> or_: 2,
> comma_op: -1,
> - collate: 7,
> + collate: 4,
> as_: -1,
> exists: 0,
> _smallest: _smallest,
> diff --git a/test/sql/test_compiler.py b/test/sql/test_compiler.py
> index f35c6a7..1773d9b 100644
> --- a/test/sql/test_compiler.py
> +++ b/test/sql/test_compiler.py
> @@ -1371,21 +1371,27 @@ class SelectTest(fixtures.TestBase,
AssertsCompiledSQL):
>
> expr =
select([table1.c.name.collate('latin1_german2_ci').like('%x%')])
> self.assert_compile(expr,
> - "SELECT mytable.name COLLATE
latin1_german2_ci "
> + "SELECT (mytable.name COLLATE
latin1_german2_ci) "
> "LIKE :param_1 AS anon_1 FROM mytable")
>
> expr = select([table1.c.name.like(collate('%x%',
> 'latin1_german2_ci'))])
> self.assert_compile(expr,
> "SELECT mytable.name "
> - "LIKE :param_1 COLLATE latin1_german2_ci AS
anon_1 "
> + "LIKE (:param_1 COLLATE latin1_german2_ci) AS
anon_1 "
> "FROM mytable")
>
> + expr = select([table1.c.name]).\
> +
where(table1.c.name.like('%x%').collate('latin1_german2_ci'))
> + self.assert_compile(expr, "SELECT mytable.name FROM mytable
WHERE "
> + "mytable.name LIKE :name_1 COLLATE latin1_german2_ci")
> +
> +
> expr = select([table1.c.name.collate('col1').like(
> collate('%x%', 'col2'))])
> self.assert_compile(expr,
> - "SELECT mytable.name COLLATE col1 "
> - "LIKE :param_1 COLLATE col2 AS anon_1 "
> + "SELECT (mytable.name COLLATE col1) "
> + "LIKE (:param_1 COLLATE col2) AS anon_1 "
> "FROM mytable")
>
> expr = select([func.concat('a', 'b').\
> }}}
>
--
Ticket URL: <http://www.sqlalchemy.org/trac/ticket/2879#comment:2>
sqlalchemy <http://www.sqlalchemy.org/>
The Database Toolkit for Python
|
|
From: sqlalchemy <mi...@zz...> - 2013-12-04 20:03:40
|
#2879: MS-SQL: Incorrect syntax near the keyword 'COLLATE'.
-------------------------------------------+-------------------------------
Reporter: krysros | Owner: zzzeek
Type: defect | Status: new
Priority: high | Milestone: 0.9.0
Component: orm | Severity: major - 1-3 hours
Resolution: | Keywords: collate
Progress State: needs questions answered |
-------------------------------------------+-------------------------------
Changes (by zzzeek):
* priority: medium => high
* severity: no triage selected yet => major - 1-3 hours
* status_field: awaiting triage => needs questions answered
Comment:
Well we'd need to consider if a global change to the precedence of COLLATE
is warranted, you can get that now like:
{{{
from sqlalchemy.sql import operators
operators._PRECEDENCE[operators.collate] = 4
}}}
a patch with some unit test changes follows, I'd need to research how
COLLATE is applied on other backends to see if this change is universally
appropriate:
{{{
#!diff
diff --git a/lib/sqlalchemy/sql/operators.py
b/lib/sqlalchemy/sql/operators.py
index 2ccc878..9220cf1 100644
--- a/lib/sqlalchemy/sql/operators.py
+++ b/lib/sqlalchemy/sql/operators.py
@@ -821,7 +821,7 @@ _PRECEDENCE = {
and_: 3,
or_: 2,
comma_op: -1,
- collate: 7,
+ collate: 4,
as_: -1,
exists: 0,
_smallest: _smallest,
diff --git a/test/sql/test_compiler.py b/test/sql/test_compiler.py
index f35c6a7..1773d9b 100644
--- a/test/sql/test_compiler.py
+++ b/test/sql/test_compiler.py
@@ -1371,21 +1371,27 @@ class SelectTest(fixtures.TestBase,
AssertsCompiledSQL):
expr =
select([table1.c.name.collate('latin1_german2_ci').like('%x%')])
self.assert_compile(expr,
- "SELECT mytable.name COLLATE
latin1_german2_ci "
+ "SELECT (mytable.name COLLATE
latin1_german2_ci) "
"LIKE :param_1 AS anon_1 FROM mytable")
expr = select([table1.c.name.like(collate('%x%',
'latin1_german2_ci'))])
self.assert_compile(expr,
"SELECT mytable.name "
- "LIKE :param_1 COLLATE latin1_german2_ci AS
anon_1 "
+ "LIKE (:param_1 COLLATE latin1_german2_ci) AS
anon_1 "
"FROM mytable")
+ expr = select([table1.c.name]).\
+ where(table1.c.name.like('%x%').collate('latin1_german2_ci'))
+ self.assert_compile(expr, "SELECT mytable.name FROM mytable WHERE
"
+ "mytable.name LIKE :name_1 COLLATE latin1_german2_ci")
+
+
expr = select([table1.c.name.collate('col1').like(
collate('%x%', 'col2'))])
self.assert_compile(expr,
- "SELECT mytable.name COLLATE col1 "
- "LIKE :param_1 COLLATE col2 AS anon_1 "
+ "SELECT (mytable.name COLLATE col1) "
+ "LIKE (:param_1 COLLATE col2) AS anon_1 "
"FROM mytable")
expr = select([func.concat('a', 'b').\
}}}
--
Ticket URL: <http://www.sqlalchemy.org/trac/ticket/2879#comment:1>
sqlalchemy <http://www.sqlalchemy.org/>
The Database Toolkit for Python
|
|
From: sqlalchemy <mi...@zz...> - 2013-12-04 19:39:53
|
#2879: MS-SQL: Incorrect syntax near the keyword 'COLLATE'.
---------------------+-----------------------------------------
Reporter: krysros | Owner: zzzeek
Type: defect | Status: new
Priority: medium | Milestone: 0.9.0
Component: orm | Severity: no triage selected yet
Keywords: collate | Progress State: awaiting triage
---------------------+-----------------------------------------
SQLAlchemy produce incorrect SQL in this case:
{{{
rows = DBSession.query(Categories.CategoryID, Categories.Category).\
filter(collate(Categories.Category.like(letter_),
'SQL_Latin1_General_CP1_CI_AI')).\
order_by(Categories.Category)
}}}
'''Result:'''
{{{
SELECT [Categories].[CategoryID] AS [Categories_CategoryID],
[Categories].[Category] AS [Categories_Category]
FROM [Categories]
WHERE ([Categories].[Category] LIKE ?)
COLLATE SQL_Latin1_General_CP1_CI_AI
ORDER BY [Categories].[Category]
}}}
'''Throw:'''
{{{
ProgrammingError: (ProgrammingError) ('42000', "[42000] [Microsoft][SQL
Server Native Client 11.0][SQL Server]Incorrect syntax near the keyword
'COLLATE'. (156) (SQLExecDirectW)") 'SELECT [Categories].[CategoryID] AS
[Categories_CategoryID], [Categories].[Category] AS [Categories_Category]
\nFROM [Categories] \nWHERE ([Categories].[Category] LIKE ?) COLLATE
SQL_Latin1_General_CP1_CI_AI ORDER BY [Categories].[Category]' ('a%',)
}}}
Code without parentheses around WHERE or with COLLATE inside the
parentheses works as expected:
{{{
rows = DBSession.execute("""
SELECT [Categories].[CategoryID] AS [Categories_CategoryID],
[Categories].[Category] AS [Categories_Category]
FROM [Categories]
WHERE [Categories].[Category] LIKE :letter
COLLATE SQL_Latin1_General_CP1_CI_AI
ORDER BY [Categories].[Category]
""", {'letter': letter_}).fetchall()
rows = DBSession.execute("""
SELECT [Categories].[CategoryID] AS [Categories_CategoryID],
[Categories].[Category] AS [Categories_Category]
FROM [Categories]
WHERE ([Categories].[Category] LIKE :letter COLLATE
SQL_Latin1_General_CP1_CI_AI)
ORDER BY [Categories].[Category]
""", {'letter': letter_}).fetchall()
}}}
Windows 7, Python 3.3.3, Pyramid 1.4.5, SQLAlchemy 0.9.0b1.
--
Ticket URL: <http://www.sqlalchemy.org/trac/ticket/2879>
sqlalchemy <http://www.sqlalchemy.org/>
The Database Toolkit for Python
|
|
From: sqlalchemy <mi...@zz...> - 2013-12-03 20:02:27
|
#1443: reflect check constraints (uniques done)
------------------------------+---------------------------------
Reporter: guest | Owner: zzzeek
Type: enhancement | Status: new
Priority: medium | Milestone: 0.x.xx
Component: postgres | Severity: major - 1-3 hours
Resolution: | Keywords: reflect constraints
Progress State: in progress |
------------------------------+---------------------------------
Comment (by zzzeek):
backport to 0.8:
rbddf55fef6d62b180042f367eb0ad73166d5bf00 0.9
re8458ab96b1bda5f139d34a24808167dd1f59 0.8
--
Ticket URL: <http://www.sqlalchemy.org/trac/ticket/1443#comment:5>
sqlalchemy <http://www.sqlalchemy.org/>
The Database Toolkit for Python
|
|
From: sqlalchemy <mi...@zz...> - 2013-12-03 19:50:02
|
#1443: reflect check constraints (uniques done)
------------------------------+---------------------------------
Reporter: guest | Owner: zzzeek
Type: enhancement | Status: new
Priority: medium | Milestone: 0.x.xx
Component: postgres | Severity: major - 1-3 hours
Resolution: | Keywords: reflect constraints
Progress State: in progress |
------------------------------+---------------------------------
Changes (by zzzeek):
* status_field: needs a volunteer => in progress
Comment:
this feature needs to be backported to 0.8, due to the alembic release
including index reflection, people are going to be hitting confusion over
index/uniques in postgresql. Also the methods needs versionadded
annotations.
--
Ticket URL: <http://www.sqlalchemy.org/trac/ticket/1443#comment:4>
sqlalchemy <http://www.sqlalchemy.org/>
The Database Toolkit for Python
|
|
From: sqlalchemy <mi...@zz...> - 2013-12-03 18:47:17
|
#2865: declarative reflective base needs to handle "secondary"
-----------------------------------+----------------------------------
Reporter: zzzeek | Owner: zzzeek
Type: defect | Status: closed
Priority: high | Milestone: 0.9.0
Component: declarative | Severity: minor - half an hour
Resolution: fixed | Keywords:
Progress State: completed/closed |
-----------------------------------+----------------------------------
Changes (by zzzeek):
* status: new => closed
* resolution: => fixed
* status_field: needs tests => completed/closed
Comment:
r36e1aa0afdf7e42f88426da4b
--
Ticket URL: <http://www.sqlalchemy.org/trac/ticket/2865#comment:2>
sqlalchemy <http://www.sqlalchemy.org/>
The Database Toolkit for Python
|
|
From: sqlalchemy <mi...@zz...> - 2013-12-03 18:19:55
|
#2864: Disconnect via IDLE_TIME resource limit not handled by SQLAlchemy
-----------------------------------+-----------------------------------
Reporter: Bluehorn | Owner: zzzeek
Type: defect | Status: closed
Priority: high | Milestone: 0.8.xx
Component: oracle | Severity: trivial - <10 minutes
Resolution: fixed | Keywords:
Progress State: completed/closed |
-----------------------------------+-----------------------------------
Changes (by zzzeek):
* status: new => closed
* status_field: in queue => completed/closed
* resolution: => fixed
* milestone: 0.9.0 => 0.8.xx
Comment:
rf2f54e04a54be79dea054ebede72befdd0dd4b6c 0.8
r21feea9c1d278036cc37add813b72d0dbd4b1754 0.9
--
Ticket URL: <http://www.sqlalchemy.org/trac/ticket/2864#comment:7>
sqlalchemy <http://www.sqlalchemy.org/>
The Database Toolkit for Python
|
|
From: sqlalchemy <mi...@zz...> - 2013-12-02 17:42:01
|
#1535: create "non backref" attribute extension option, add flag to @validates()
-----------------------------------+----------------------------------
Reporter: zzzeek | Owner: zzzeek
Type: defect | Status: closed
Priority: medium | Milestone: 0.9.0
Component: orm | Severity: minor - half an hour
Resolution: fixed | Keywords:
Progress State: completed/closed |
-----------------------------------+----------------------------------
Changes (by zzzeek):
* status: new => closed
* milestone: 0.x.xx => 0.9.0
* resolution: => fixed
* status_field: awaiting triage => completed/closed
Comment:
r50e3847f09580d1e322fb1
--
Ticket URL: <http://www.sqlalchemy.org/trac/ticket/1535#comment:1>
sqlalchemy <http://www.sqlalchemy.org/>
The Database Toolkit for Python
|
|
From: sqlalchemy <mi...@zz...> - 2013-12-02 16:40:58
|
#2782: add the setuptools hack for setup.py test
-----------------------------------+----------------------------------
Reporter: zzzeek | Owner: zzzeek
Type: defect | Status: closed
Priority: medium | Milestone: 0.8.xx
Component: tests | Severity: minor - half an hour
Resolution: worksforme | Keywords:
Progress State: completed/closed |
-----------------------------------+----------------------------------
Changes (by zzzeek):
* status: new => closed
* resolution: => worksforme
* status_field: in queue => completed/closed
Comment:
i think setuptools has finally fixed this, just did a run, no TypeError
--
Ticket URL: <http://www.sqlalchemy.org/trac/ticket/2782#comment:1>
sqlalchemy <http://www.sqlalchemy.org/>
The Database Toolkit for Python
|
|
From: sqlalchemy <mi...@zz...> - 2013-12-02 16:36:04
|
#2864: Disconnect via IDLE_TIME resource limit not handled by SQLAlchemy
---------------------------+-----------------------------------
Reporter: Bluehorn | Owner: zzzeek
Type: defect | Status: new
Priority: high | Milestone: 0.9.0
Component: oracle | Severity: trivial - <10 minutes
Resolution: | Keywords:
Progress State: in queue |
---------------------------+-----------------------------------
Changes (by zzzeek):
* priority: medium => high
* milestone: 0.8.xx => 0.9.0
Comment:
+ backport to 0.8
--
Ticket URL: <http://www.sqlalchemy.org/trac/ticket/2864#comment:6>
sqlalchemy <http://www.sqlalchemy.org/>
The Database Toolkit for Python
|
|
From: sqlalchemy <mi...@zz...> - 2013-11-30 18:55:33
|
#2878: postgresql (psycopg2) Enum type breaks if enum label contains a single
quote (')
-----------------------------------+----------------------------------
Reporter: kwohlfahrt | Owner: zzzeek
Type: defect | Status: closed
Priority: medium | Milestone: 0.9.0
Component: postgres | Severity: minor - half an hour
Resolution: fixed | Keywords:
Progress State: completed/closed |
-----------------------------------+----------------------------------
Changes (by zzzeek):
* status: new => closed
* status_field: awaiting triage => completed/closed
* resolution: => fixed
* severity: no triage selected yet => minor - half an hour
* milestone: => 0.9.0
Comment:
r66773a8801a584d36b514e22a03, for 0.8 people may be working around this
already with manually escaping the quotes, this is in for 0.9.
--
Ticket URL: <http://www.sqlalchemy.org/trac/ticket/2878#comment:1>
sqlalchemy <http://www.sqlalchemy.org/>
The Database Toolkit for Python
|
|
From: sqlalchemy <mi...@zz...> - 2013-11-30 17:59:35
|
#2878: postgresql (psycopg2) Enum type breaks if enum label contains a single
quote (')
------------------------+-----------------------------------------
Reporter: kwohlfahrt | Owner: zzzeek
Type: defect | Status: new
Priority: medium | Milestone:
Component: postgres | Severity: no triage selected yet
Keywords: | Progress State: awaiting triage
------------------------+-----------------------------------------
When creating an Enum column on a postgresql database, the following
example errors out with a syntax error on the s in "Men's Captain". In
postgresql single quotes in an enum label must be doubled, like {{{
"Men''s Captain" }}}.
{{{
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy import Column, Integer, Enum
from sqlalchemy import create_engine
from sqlalchemy.orm import sessionmaker
Base = declarative_base()
class Foo(Base):
__tablename__ = 'foo'
id = Column(Integer, primary_key=True)
foo = Column(Enum("President", "Men's Captain",
name="committee_position"))
if __name__ == '__main__':
engine = create_engine('postgresql://test@localhost/test')
Base.metadata.create_all(engine)
}}}
Traceback
{{{
Traceback (most recent call last):
File "/usr/lib64/python3.2/site-packages/sqlalchemy/engine/base.py",
line 867, in _execute_context
context)
File "/usr/lib64/python3.2/site-packages/sqlalchemy/engine/default.py",
line 326, in do_execute
cursor.execute(statement, parameters)
psycopg2.ProgrammingError: syntax error at or near "s"
LINE 1: ...TYPE committee_position AS ENUM ('President','Men's Captain'...
^
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "test.py", line 16, in <module>
Base.metadata.create_all(engine)
File "/usr/lib64/python3.2/site-packages/sqlalchemy/schema.py", line
2796, in create_all
tables=tables)
File "/usr/lib64/python3.2/site-packages/sqlalchemy/engine/base.py",
line 1479, in _run_visitor
conn._run_visitor(visitorcallable, element, **kwargs)
File "/usr/lib64/python3.2/site-packages/sqlalchemy/engine/base.py",
line 1122, in _run_visitor
**kwargs).traverse_single(element)
File "/usr/lib64/python3.2/site-packages/sqlalchemy/sql/visitors.py",
line 109, in traverse_single
return meth(obj, **kw)
File "/usr/lib64/python3.2/site-packages/sqlalchemy/engine/ddl.py", line
70, in visit_metadata
self.traverse_single(table, create_ok=True)
File "/usr/lib64/python3.2/site-packages/sqlalchemy/sql/visitors.py",
line 109, in traverse_single
return meth(obj, **kw)
File "/usr/lib64/python3.2/site-packages/sqlalchemy/engine/ddl.py", line
83, in visit_table
_ddl_runner=self)
File "/usr/lib64/python3.2/site-packages/sqlalchemy/event.py", line 407,
in __call__
fn(*args, **kw)
File "/usr/lib64/python3.2/site-
packages/sqlalchemy/util/langhelpers.py", line 407, in __call__
return getattr(self.target, self.name)(*arg, **kw)
File "/usr/lib64/python3.2/site-packages/sqlalchemy/types.py", line
1937, in _on_table_create
t._on_table_create(target, bind, **kw)
File "/usr/lib64/python3.2/site-
packages/sqlalchemy/dialects/postgresql/base.py", line 870, in
_on_table_create
self.create(bind=bind, checkfirst=checkfirst)
File "/usr/lib64/python3.2/site-
packages/sqlalchemy/dialects/postgresql/base.py", line 821, in create
bind.execute(CreateEnumType(self))
File "/usr/lib64/python3.2/site-packages/sqlalchemy/engine/base.py",
line 662, in execute
params)
File "/usr/lib64/python3.2/site-packages/sqlalchemy/engine/base.py",
line 720, in _execute_ddl
compiled
File "/usr/lib64/python3.2/site-packages/sqlalchemy/engine/base.py",
line 874, in _execute_context
context)
File "/usr/lib64/python3.2/site-packages/sqlalchemy/engine/base.py",
line 1024, in _handle_dbapi_exception
exc_info
File "/usr/lib64/python3.2/site-packages/sqlalchemy/util/compat.py",
line 187, in raise_from_cause
reraise(type(exception), exception, tb=exc_tb, cause=exc_value)
File "/usr/lib64/python3.2/site-packages/sqlalchemy/util/compat.py",
line 182, in reraise
raise value.with_traceback(tb)
File "/usr/lib64/python3.2/site-packages/sqlalchemy/engine/base.py",
line 867, in _execute_context
context)
File "/usr/lib64/python3.2/site-packages/sqlalchemy/engine/default.py",
line 326, in do_execute
cursor.execute(statement, parameters)
sqlalchemy.exc.ProgrammingError: (ProgrammingError) syntax error at or
near "s"
LINE 1: ...TYPE committee_position AS ENUM ('President','Men's Captain'...
^
"CREATE TYPE committee_position AS ENUM ('President','Men's Captain')" {}
}}}
--
Ticket URL: <http://www.sqlalchemy.org/trac/ticket/2878>
sqlalchemy <http://www.sqlalchemy.org/>
The Database Toolkit for Python
|
|
From: sqlalchemy <mi...@zz...> - 2013-11-29 21:42:53
|
#2355: implement pyodbc + mssql + py3k
-----------------------------------+-------------------------------
Reporter: guest | Owner:
Type: enhancement | Status: closed
Priority: high | Milestone: 0.9.xx
Component: mssql | Severity: major - 1-3 hours
Resolution: fixed | Keywords:
Progress State: completed/closed |
-----------------------------------+-------------------------------
Changes (by zzzeek):
* status: new => closed
* resolution: => fixed
* status_field: in queue => completed/closed
Comment:
peopel are using pyodbc + py3k successfully now in 0.9, I'm sure there's
still issues but we can open new tickets as they are reported.
--
Ticket URL: <http://www.sqlalchemy.org/trac/ticket/2355#comment:9>
sqlalchemy <http://www.sqlalchemy.org/>
The Database Toolkit for Python
|
|
From: sqlalchemy <mi...@zz...> - 2013-11-29 20:06:24
|
#2877: text as from
-----------------------------------+-------------------------------
Reporter: zzzeek | Owner: zzzeek
Type: enhancement | Status: closed
Priority: high | Milestone: 0.9.0
Component: sql | Severity: major - 1-3 hours
Resolution: fixed | Keywords:
Progress State: completed/closed |
-----------------------------------+-------------------------------
Changes (by zzzeek):
* status: new => closed
* resolution: => fixed
* status_field: in progress => completed/closed
Comment:
r6c83ef761beb162981615fba1c2
--
Ticket URL: <http://www.sqlalchemy.org/trac/ticket/2877#comment:1>
sqlalchemy <http://www.sqlalchemy.org/>
The Database Toolkit for Python
|
|
From: sqlalchemy <mi...@zz...> - 2013-11-29 17:11:45
|
#2877: text as from
-------------------------+------------------------------------
Reporter: zzzeek | Owner: zzzeek
Type: enhancement | Status: new
Priority: high | Milestone: 0.9.0
Component: sql | Severity: major - 1-3 hours
Keywords: | Progress State: in progress
-------------------------+------------------------------------
simple patch, might want to clarify `SelectBase` in general, several
methods don't apply to `CompoundSelect` either
{{{
#!diff
diff --git a/lib/sqlalchemy/sql/compiler.py
b/lib/sqlalchemy/sql/compiler.py
index 3ba3957..b088916 100644
--- a/lib/sqlalchemy/sql/compiler.py
+++ b/lib/sqlalchemy/sql/compiler.py
@@ -726,6 +726,9 @@ class SQLCompiler(Compiled):
def function_argspec(self, func, **kwargs):
return func.clause_expr._compiler_dispatch(self, **kwargs)
+ def visit_text_as_from(self, taf, asfrom=False, parens=True, **kw):
+ return self.process(taf.element, **kw)
+
def visit_compound_select(self, cs, asfrom=False,
parens=True, compound_index=0, **kwargs):
toplevel = not self.stack
diff --git a/lib/sqlalchemy/sql/elements.py
b/lib/sqlalchemy/sql/elements.py
index f349923..80ff064 100644
--- a/lib/sqlalchemy/sql/elements.py
+++ b/lib/sqlalchemy/sql/elements.py
@@ -1023,6 +1023,31 @@ class TextClause(Executable, ClauseElement):
for b in bindparams:
self.bindparams[b.key] = b
+ @util.dependencies('sqlalchemy.sql.selectable')
+ def as_fromclause(self, selectable, *cols):
+ """Turn this :class:`.Text` object into a :class:`.FromClause`
+ object that can be embedded into another statement.
+
+ This function essentially bridges the gap between an entirely
+ textual SELECT statement and the SQL expression language concept
+ of a "selectable"::
+
+ from sqlalchemy.sql import column, text
+
+ stmt = text("SELECT * FROM some_table")
+ stmt = stmt.as_fromclause(column('id'),
column('name')).alias('st')
+
+ stmt = select([mytable]).\\
+ select_from(
+ mytable.join(stmt, mytable.c.name == stmt.c.name)
+ ).where(stmt.c.id > 5)
+
+ .. versionadded:: 0.9.0
+
+ """
+
+ return selectable.TextAsFrom(self, cols)
+
@property
def type(self):
if self.typemap is not None and len(self.typemap) == 1:
diff --git a/lib/sqlalchemy/sql/selectable.py
b/lib/sqlalchemy/sql/selectable.py
index 28c757a..7a4a0b7 100644
--- a/lib/sqlalchemy/sql/selectable.py
+++ b/lib/sqlalchemy/sql/selectable.py
@@ -2912,6 +2912,25 @@ class Exists(UnaryExpression):
return e
+class TextAsFrom(SelectBase):
+ """Wrap a :class:`.Text` construct within a :class:`.FromClause`
+ interface.
+
+ This allows the :class:`.Text` object to gain a ``.c`` collection and
+ other FROM-like capabilities such as :meth:`.FromClause.alias`,
+ :meth:`.FromClause.cte`, etc.
+
+ """
+ __visit_name__ = "text_as_from"
+
+ def __init__(self, text, columns):
+ self.element = text
+ self.column_args = columns
+
+ def _populate_column_collection(self):
+ for c in self.column_args:
+ c._make_proxy(self)
+
class AnnotatedFromClause(Annotated):
def __init__(self, element, values):
# force FromClause to generate their internal
}}}
demo:
{{{
#!python
from sqlalchemy import *
from sqlalchemy.orm import *
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.sql import column
positions = text("""
select instrument_id, sum(quantity) as quantity
from transaction where
account_id = :account_id and
timestamp < :dt and
group by instrument_id
having sum(quantity) != 0
""").as_fromclause(column("instrument_id"),
column("quantity")).cte('positions')
Base = declarative_base()
class A(Base):
__tablename__ = 'a'
id = Column(Integer, primary_key=True)
data = Column(String)
s = Session()
print s.query(A).join(
positions, A.id == positions.c.instrument_id).\
filter(positions.c.quantity > 5)
}}}
--
Ticket URL: <http://www.sqlalchemy.org/trac/ticket/2877>
sqlalchemy <http://www.sqlalchemy.org/>
The Database Toolkit for Python
|
|
From: sqlalchemy <mi...@zz...> - 2013-11-28 16:28:20
|
#2581: PostgreSQL-9.2 JSON datatype
------------------------------+-------------------------------
Reporter: plaes | Owner: zzzeek
Type: enhancement | Status: new
Priority: medium | Milestone: 0.9.xx
Component: postgres | Severity: major - 1-3 hours
Resolution: | Keywords:
Progress State: in queue |
------------------------------+-------------------------------
Comment (by zzzeek):
some notes, the HSTORE type goes through the effort to provide Python-
level parsers as well as support for psycopg2's range plugin - for most
users the pure-python HSTORE serializers are not used. The RANGE type
OTOH I think took a simplistic approach and just assumes the DBAPI
handling of the data in all cases (to that extent, it probably doesn't
work on DBAPIs other than psycopg2).
for JSON, it would be best if we typically make use of whatever extensions
psycopg2 provides (I'm sure they have JSON support now), with a fallback
available for when the plugin isn't available. tests will be needed as
well.
--
Ticket URL: <http://www.sqlalchemy.org/trac/ticket/2581#comment:17>
sqlalchemy <http://www.sqlalchemy.org/>
The Database Toolkit for Python
|
|
From: sqlalchemy <mi...@zz...> - 2013-11-28 16:23:11
|
#2581: PostgreSQL-9.2 JSON datatype
------------------------------+-------------------------------
Reporter: plaes | Owner: zzzeek
Type: enhancement | Status: new
Priority: medium | Milestone: 0.9.xx
Component: postgres | Severity: major - 1-3 hours
Resolution: | Keywords:
Progress State: in queue |
------------------------------+-------------------------------
Changes (by zzzeek):
* milestone: 0.8.xx => 0.9.xx
Comment:
Replying to [comment:15 lyschoening]:
> What is the timeline for this?
JSON is relatively low priority for me to implement solely, as this is one
that anyone can contribute - you can have the feature within days via pull
request, as mentioner earlier, JSON support will look very similar to
[https://github.com/zzzeek/sqlalchemy/blob/master/lib/sqlalchemy/dialects/postgresql/hstore.py
hstore] and perhaps
[https://github.com/zzzeek/sqlalchemy/blob/master/lib/sqlalchemy/dialects/postgresql/ranges.py
range] - both of which were contributed by motivated individuals.
> The milestone clearly needs to be updated.
done!
--
Ticket URL: <http://www.sqlalchemy.org/trac/ticket/2581#comment:16>
sqlalchemy <http://www.sqlalchemy.org/>
The Database Toolkit for Python
|
|
From: sqlalchemy <mi...@zz...> - 2013-11-28 13:17:24
|
#2581: PostgreSQL-9.2 JSON datatype
------------------------------+-------------------------------
Reporter: plaes | Owner: zzzeek
Type: enhancement | Status: new
Priority: medium | Milestone: 0.8.xx
Component: postgres | Severity: major - 1-3 hours
Resolution: | Keywords:
Progress State: in queue |
------------------------------+-------------------------------
Comment (by lyschoening):
What is the timeline for this? The milestone clearly needs to be updated.
PostgreSQL 9.3 released in September has added new JSON operators
[http://www.postgresql.org/docs/9.3/static/functions-json.html] that make
this field extremely powerful.
However, at this stage even some partial support (simple dumping and
loading) would be interesting; especially if – as it looks now – support
for all the enhanced query operators will take more time or not be
introduced at all.
--
Ticket URL: <http://www.sqlalchemy.org/trac/ticket/2581#comment:15>
sqlalchemy <http://www.sqlalchemy.org/>
The Database Toolkit for Python
|
|
From: sqlalchemy <mi...@zz...> - 2013-11-27 16:20:12
|
#2876: Using relationship with primaryjoin in declared_attr fails
-----------------------------------+------------------------------------
Reporter: wichert | Owner: zzzeek
Type: defect | Status: closed
Priority: medium | Milestone:
Component: declarative | Severity: no triage selected yet
Resolution: worksforme | Keywords:
Progress State: completed/closed |
-----------------------------------+------------------------------------
Comment (by zzzeek):
docs are updated in r33e77c3077a15c51f30ac5aae724c.
--
Ticket URL: <http://www.sqlalchemy.org/trac/ticket/2876#comment:2>
sqlalchemy <http://www.sqlalchemy.org/>
The Database Toolkit for Python
|
|
From: sqlalchemy <mi...@zz...> - 2013-11-27 16:05:04
|
#2876: Using relationship with primaryjoin in declared_attr fails
-----------------------------------+------------------------------------
Reporter: wichert | Owner: zzzeek
Type: defect | Status: closed
Priority: medium | Milestone:
Component: declarative | Severity: no triage selected yet
Resolution: worksforme | Keywords:
Progress State: completed/closed |
-----------------------------------+------------------------------------
Changes (by zzzeek):
* status: new => closed
* resolution: => worksforme
* status_field: awaiting triage => completed/closed
Comment:
TL;DR; - this situation is documented at
http://docs.sqlalchemy.org/en/rel_0_9/orm/extensions/declarative.html
#mixing-in-relationships
relationship() definitions which require explicit primaryjoin,
order_by etc. expressions should use the string forms for these arguments,
so that they are evaluated as late as possible. To reference the mixin
class in these expressions, use the given cls to get its name:
The error message here is improved in 0.9, where you will get:
{{{
File "/Users/classic/dev/sqlalchemy/lib/sqlalchemy/sql/schema.py", line
1485, in _resolve_col_tokens
"this ForeignKey's parent column is not yet associated "
sqlalchemy.exc.InvalidRequestError: this ForeignKey's parent column is not
yet associated with a Table.
}}}
Your method avatar_original_id creates a new `Column` object *each time it
is called*. When you call it within your `avatar_original` method, you
get a `Column` back, but '''that Column object is unknown to any other
aspect of the program'''.
So the class gets mapped normally, declarative calls upon
`avatar_original_id` to get at the `Column` that will actually be mapped,
and the one you've put in your `relationship()` has no parent table.
The solution - except in the most simplistic cases, strings or lambdas
should always be used for relationship arguments in declarative:
{{{
#!python
@declared_attr
def avatar_original(cls):
return relationship(Image, cascade='all',
primaryjoin=lambda: (cls.avatar_original_id == Image.id))
}}}
or
{{{
#!python
@declared_attr
def avatar_original(cls):
return relationship(Image, cascade='all',
primaryjoin="%s.avatar_original_id == Image.id" %
cls.__name__)
}}}
the latter is documented in the last example at:
http://docs.sqlalchemy.org/en/rel_0_9/orm/extensions/declarative.html
#mixing-in-relationships
the "lambda:" form should probably be added to the docs as it is handy.
--
Ticket URL: <http://www.sqlalchemy.org/trac/ticket/2876#comment:1>
sqlalchemy <http://www.sqlalchemy.org/>
The Database Toolkit for Python
|
|
From: sqlalchemy <mi...@zz...> - 2013-11-27 13:27:58
|
#2876: Using relationship with primaryjoin in declared_attr fails
-------------------------+-----------------------------------------
Reporter: wichert | Owner: zzzeek
Type: defect | Status: new
Priority: medium | Milestone:
Component: declarative | Severity: no triage selected yet
Keywords: | Progress State: awaiting triage
-------------------------+-----------------------------------------
(Almost) minimal test case:
{{{
#!python
import sqlalchemy
from sqlalchemy import schema
from sqlalchemy import types
from sqlalchemy.orm import relationship
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.ext.declarative import declared_attr
metadata = schema.MetaData()
BaseObject = declarative_base(metadata=metadata)
class Image(BaseObject):
__tablename__ = 'image'
id = schema.Column(types.Integer(), primary_key=True,
autoincrement=True)
class AvatarMixin(object):
@declared_attr
def avatar_original_id(cls):
return schema.Column('avatar_original_id', types.Integer(),
schema.ForeignKey('image.id', onupdate='CASCADE',
ondelete='RESTRICT'),
unique=True)
@declared_attr
def avatar_original(cls):
return relationship(Image, cascade='all',
primaryjoin=(cls.avatar_original_id == Image.id))
@declared_attr
def avatar_id(cls):
return schema.Column('avatar_id', types.Integer(),
schema.ForeignKey('image.id', onupdate='CASCADE',
ondelete='RESTRICT'),
unique=True)
class User(BaseObject, AvatarMixin):
__tablename__ = 'user'
id = schema.Column(types.Integer(), primary_key=True,
autoincrement=True)
engine = sqlalchemy.create_engine('sqlite:///:memory:')
metadata.create_all(engine)
User()
}}}
results in this output:
{{{
...
File
"/Users/wichert/Library/buildout/eggs/SQLAlchemy-0.8.3-py2.7-macosx-10.9-x86_64.egg/sqlalchemy/schema.py",
line 1026, in references
if fk.column.proxy_set.intersection(column.proxy_set):
File
"/Users/wichert/Library/buildout/eggs/SQLAlchemy-0.8.3-py2.7-macosx-10.9-x86_64.egg/sqlalchemy/util/langhelpers.py",
line 612, in __get__
obj.__dict__[self.__name__] = result = self.fget(obj)
File
"/Users/wichert/Library/buildout/eggs/SQLAlchemy-0.8.3-py2.7-macosx-10.9-x86_64.egg/sqlalchemy/schema.py",
line 1456, in column
if schema is None and parenttable.metadata.schema is not None:
AttributeError: 'NoneType' object has no attribute 'metadata'
}}}
--
Ticket URL: <http://www.sqlalchemy.org/trac/ticket/2876>
sqlalchemy <http://www.sqlalchemy.org/>
The Database Toolkit for Python
|
|
From: sqlalchemy <mi...@zz...> - 2013-11-26 00:19:11
|
#2875: attempt to improve the system by which engine_from_config locates keys w/
special values
------------------------------+----------------------------------
Reporter: zzzeek | Owner: zzzeek
Type: enhancement | Status: new
Priority: high | Milestone: 0.9.0
Component: engine | Severity: minor - half an hour
Resolution: | Keywords:
Progress State: in queue |
------------------------------+----------------------------------
Comment (by zzzeek):
add it to the default strategy once we have the dialect class:
{{{
#!diff
diff --git a/lib/sqlalchemy/engine/__init__.py
b/lib/sqlalchemy/engine/__init__.py
index 16d2141..128c4e8 100644
--- a/lib/sqlalchemy/engine/__init__.py
+++ b/lib/sqlalchemy/engine/__init__.py
@@ -348,10 +348,13 @@ def engine_from_config(configuration,
prefix='sqlalchemy.', **kwargs):
arguments.
"""
- opts = util._coerce_config(configuration, prefix)
- opts.update(kwargs)
- url = opts.pop('url')
- return create_engine(url, **opts)
+ options = dict((key[len(prefix):], configuration[key])
+ for key in configuration
+ if key.startswith(prefix))
+ options['_coerce_config'] = True
+ options.update(kwargs)
+ url = options.pop('url')
+ return create_engine(url, **options)
__all__ = (
diff --git a/lib/sqlalchemy/engine/default.py
b/lib/sqlalchemy/engine/default.py
index 8fb7c3b..007a3ab 100644
--- a/lib/sqlalchemy/engine/default.py
+++ b/lib/sqlalchemy/engine/default.py
@@ -59,6 +59,18 @@ class DefaultDialect(interfaces.Dialect):
supports_simple_order_by_label = True
+ engine_config_types = dict([
+ ('convert_unicode', util.bool_or_str('force')),
+ ('pool_timeout', int),
+ ('echo', util.bool_or_str('debug')),
+ ('echo_pool', util.bool_or_str('debug')),
+ ('pool_recycle', int),
+ ('pool_size', int),
+ ('max_overflow', int),
+ ('pool_threadlocal', bool),
+ ('use_native_unicode', bool),
+ ])
+
# if the NUMERIC type
# returns decimal.Decimal.
# *not* the FLOAT type however.
diff --git a/lib/sqlalchemy/engine/strategies.py
b/lib/sqlalchemy/engine/strategies.py
index ab9d370..aea2fc3 100644
--- a/lib/sqlalchemy/engine/strategies.py
+++ b/lib/sqlalchemy/engine/strategies.py
@@ -49,11 +49,16 @@ class DefaultEngineStrategy(EngineStrategy):
dialect_cls = u.get_dialect()
+ coerce_config = kwargs.pop('_coerce_config', False)
+
dialect_args = {}
# consume dialect arguments from kwargs
for k in util.get_cls_kwargs(dialect_cls):
if k in kwargs:
- dialect_args[k] = kwargs.pop(k)
+ value = kwargs.pop(k)
+ if coerce_config and k in
dialect_cls.engine_config_types:
+ value = dialect_cls.engine_config_types[k](value)
+ dialect_args[k] = value
dbapi = kwargs.pop('module', None)
if dbapi is None:
}}}
--
Ticket URL: <http://www.sqlalchemy.org/trac/ticket/2875#comment:1>
sqlalchemy <http://www.sqlalchemy.org/>
The Database Toolkit for Python
|