sqlalchemy-tickets Mailing List for SQLAlchemy (Page 67)
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-11 14:07:38
|
#2886: Add an officially supported query compilation function
-------------------------+-----------------------------------------
Reporter: agronholm | Owner: zzzeek
Type: enhancement | Status: new
Priority: medium | Milestone:
Component: utils | Severity: no triage selected yet
Keywords: | Progress State: awaiting triage
-------------------------+-----------------------------------------
Often, when my queries are not accepted by the backend (ProgrammingError)
I want to look at the generated SQL and tinker with it, executing it
directly on the backend until I figure out what's wrong. Trouble is, when
I print the query with str(query), it gives me the non-interpolated
version of the query (ie. with the placeholders not filled in). Many
people have been asking for a way to get a compiled version of the query,
which could be copypasted directly to psql or whatever.
SQLACodegen also requires a method for compiling expressions, given a
dialect.
I've used an adapted version of this:
http://stackoverflow.com/a/5698357/242021
However, the 0.8.3 update broke it. One of my tests is now giving me:
{{{
AttributeError: Neither 'Label' object nor 'Comparator' object has an
attribute 'table'
}}}
That's one more reason why I'm requesting an official compiling method
that won't break with micro version updates of SQLAlchemy.
--
Ticket URL: <http://www.sqlalchemy.org/trac/ticket/2886>
sqlalchemy <http://www.sqlalchemy.org/>
The Database Toolkit for Python
|
|
From: sqlalchemy <mi...@zz...> - 2013-12-09 17:03:02
|
#2885: reduce for proxied columns when syncing between mappers
--------------------+---------------------------------------
Reporter: zzzeek | Owner: zzzeek
Type: defect | Status: new
Priority: high | Milestone: 0.9.0
Component: orm | Severity: minor - half an hour
Keywords: | Progress State: needs tests
--------------------+---------------------------------------
this is probably for backport to 0.8 as well
{{{
#!python
from sqlalchemy import select, Table, Column, Integer, ForeignKey,
create_engine, Text, Float
from sqlalchemy.orm import Session
from sqlalchemy.ext.declarative import declarative_base
Base = declarative_base()
class Person(Base):
__table_actual__ = Table('person', Base.metadata,
Column('id', Integer, primary_key=True),
Column('name', Text),
Column('type', Text)
)
__table__ = select([__table_actual__]).alias("person_alias")
__mapper_args__ = {"polymorphic_on": __table__.c.type,
"polymorphic_identity": "Person"}
class Golfer(Person):
__tablename__ = "golfer"
id_person = Column(Integer, ForeignKey(Person.__table_actual__.c.id),
primary_key=True)
handicap = Column(Float)
__mapper_args__ = {"polymorphic_identity": "Golfer"}
engine = create_engine('sqlite://', echo=True)
Base.metadata.create_all(engine)
session = Session(engine)
p1 = Person(name="Joe Bloggs")
session.add(p1)
g1 = Golfer(name="Tiger Woods", handicap=2.5)
session.add(g1)
session.commit()
print(g1.name)
}}}
patch:
{{{
#!diff
diff --git a/lib/sqlalchemy/orm/mapper.py b/lib/sqlalchemy/orm/mapper.py
index b3b872f..bdaeca0 100644
--- a/lib/sqlalchemy/orm/mapper.py
+++ b/lib/sqlalchemy/orm/mapper.py
@@ -2488,7 +2488,8 @@ class Mapper(_InspectionAttr):
for m in self.iterate_to_root():
if m._inherits_equated_pairs and \
cols.intersection(
- [l for l, r in m._inherits_equated_pairs]):
+ util.reduce(set.union,
+ [l.proxy_set for l, r in
m._inherits_equated_pairs])):
result[table].append((m, m._inherits_equated_pairs))
return result
}}}
--
Ticket URL: <http://www.sqlalchemy.org/trac/ticket/2885>
sqlalchemy <http://www.sqlalchemy.org/>
The Database Toolkit for Python
|
|
From: sqlalchemy <mi...@zz...> - 2013-12-09 16:58:31
|
#2884: crappy looking declarative error when bad mapper arg is passed
--------------------+---------------------------------------
Reporter: zzzeek | Owner: zzzeek
Type: defect | Status: new
Priority: medium | Milestone: 0.9.0
Component: orm | Severity: minor - half an hour
Keywords: | Progress State: in queue
--------------------+---------------------------------------
{{{
#!python
from sqlalchemy import *
from sqlalchemy.orm import *
from sqlalchemy.ext.declarative import declarative_base
Base = declarative_base()
class A(Base):
__tablename__ = 'a'
id = Column(Integer, primary_key=True)
__mapper_args__ = {"bogus": "bogus"}
}}}
{{{
Traceback (most recent call last):
File "test3.py", line 7, in <module>
class A(Base):
File
"/Users/classic/dev/sqlalchemy/lib/sqlalchemy/ext/declarative/api.py",
line 53, in __init__
_as_declarative(cls, classname, cls.__dict__)
File
"/Users/classic/dev/sqlalchemy/lib/sqlalchemy/ext/declarative/base.py",
line 292, in _as_declarative
mt.map()
File
"/Users/classic/dev/sqlalchemy/lib/sqlalchemy/ext/declarative/base.py",
line 376, in map
**mapper_args
TypeError: Error when calling the metaclass bases
<lambda>() got an unexpected keyword argument 'bogus'
}}}
--
Ticket URL: <http://www.sqlalchemy.org/trac/ticket/2884>
sqlalchemy <http://www.sqlalchemy.org/>
The Database Toolkit for Python
|
|
From: sqlalchemy <mi...@zz...> - 2013-12-09 16:45:25
|
#2883: foreign key to a non-table doesn't raise (correctly, consistently)
------------------------------+----------------------------------
Reporter: zzzeek | Owner: zzzeek
Type: defect | Status: new
Priority: high | Milestone: 0.9.0
Component: schema | Severity: minor - half an hour
Resolution: | Keywords:
Progress State: needs tests |
------------------------------+----------------------------------
Description changed by zzzeek:
Old description:
> {{{
> #!python
> from sqlalchemy import *
>
> m = MetaData()
> t1 = Table('t1', m, Column('x', Integer))
> t1a = t1.select().alias()
>
> t2 = Table('t2', m, Column('y', Integer, ForeignKey(t1a.c.x)))
>
> print repr(t2)}}}
>
> in 0.8:
>
> {{{
> File "/Users/classic/tmp/sa084/lib/sqlalchemy/schema.py", line 1337, in
> __repr__
> return "ForeignKey(%r)" % self._get_colspec()
> File "/Users/classic/tmp/sa084/lib/sqlalchemy/schema.py", line 1387, in
> _get_colspec
> return "%s.%s" % (_column.table.fullname, _column.key)
> AttributeError: 'Alias' object has no attribute 'fullname'
> }}}
>
> in 0.9, that error would happen, but is blocked by this:
>
> {{{
> File "/Users/classic/dev/sqlalchemy/lib/sqlalchemy/sql/schema.py", line
> 1635, in _set_table
> self.constraint._set_parent_with_dispatch(table)
> File "/Users/classic/dev/sqlalchemy/lib/sqlalchemy/sql/base.py", line
> 171, in _set_parent_with_dispatch
> self._set_parent(parent)
> File "/Users/classic/dev/sqlalchemy/lib/sqlalchemy/sql/schema.py", line
> 2444, in _set_parent
> self._validate_dest_table(table)
> File "/Users/classic/dev/sqlalchemy/lib/sqlalchemy/sql/schema.py", line
> 2417, in _validate_dest_table
> table_keys = set([elem._table_key() for elem in
> self._elements.values()])
> File "/Users/classic/dev/sqlalchemy/lib/sqlalchemy/sql/schema.py", line
> 1475, in _table_key
> return _column.table.key
> AttributeError: 'Alias' object has no attribute 'key'
> }}}
>
> patch:
>
> {{{
> #!diff
> diff --git a/lib/sqlalchemy/sql/schema.py b/lib/sqlalchemy/sql/schema.py
> index 7bf543a..ec1d430 100644
> --- a/lib/sqlalchemy/sql/schema.py
> +++ b/lib/sqlalchemy/sql/schema.py
> @@ -1340,6 +1340,7 @@ class ForeignKey(SchemaItem):
> """
>
> self._colspec = column
> + self._setup_colspec_arg(column)
>
> # the linked ForeignKeyConstraint.
> # ForeignKey will create this when parent Column
> @@ -1389,6 +1390,27 @@ class ForeignKey(SchemaItem):
> )
> return self._schema_item_copy(fk)
>
> + def _setup_colspec_arg(self, _colspec):
> + if isinstance(self._colspec, util.string_types):
> + self._table_column = None
> + return
> + elif hasattr(self._colspec, '__clause_element__'):
> + _column = self._colspec.__clause_element__()
> + else:
> + _column = self._colspec
> +
> + if not isinstance(_column, ColumnClause):
> + raise exc.ArgumentError(
> + "String, Column, or Column-bound argument "
> + "expected, got %r" % _column)
> + elif not isinstance(_column.table, (util.NoneType,
> TableClause)):
> + raise exc.ArgumentError(
> + "ForeignKey received Column not bound "
> + "to a Table, got: %r" % _column.table
> + )
> + self._table_column = _column
> +
> +
> def _get_colspec(self, schema=None):
> """Return a string based 'column specification' for this
> :class:`.ForeignKey`.
> @@ -1398,16 +1420,25 @@ class ForeignKey(SchemaItem):
>
> """
> if schema:
> - return schema + "." + self.column.table.name + \
> - "." + self.column.key
> - elif isinstance(self._colspec, util.string_types):
> + _schema, tname, colname = self._column_tokens
> + return "%s.%s.%s" % (schema, tname, colname)
> + elif self._table_column is not None:
> + return "%s.%s" % (
> + self._table_column.table.fullname,
> self._table_column.key)
> + else:
> return self._colspec
> - elif hasattr(self._colspec, '__clause_element__'):
> - _column = self._colspec.__clause_element__()
> +
> +
> + def _table_key(self):
> + if self._table_column is not None:
> + if self._table_column.table is None:
> + return None
> + else:
> + return self._table_column.table.key
> else:
> - _column = self._colspec
> + schema, tname, colname = self._column_tokens
> + return _get_table_key(tname, schema)
>
> - return "%s.%s" % (_column.table.fullname, _column.key)
>
> target_fullname = property(_get_colspec)
> @@ -1460,20 +1491,6 @@ class ForeignKey(SchemaItem):
> schema = None
> return schema, tname, colname
>
> - def _table_key(self):
> - if isinstance(self._colspec, util.string_types):
> - schema, tname, colname = self._column_tokens
> - return _get_table_key(tname, schema)
> - elif hasattr(self._colspec, '__clause_element__'):
> - _column = self._colspec.__clause_element__()
> - else:
> - _column = self._colspec
> -
> - if _column.table is None:
> - return None
> - else:
> - return _column.table.key
> -
> def _resolve_col_tokens(self):
> if self.parent is None:
> raise exc.InvalidRequestError(
> }}}
New description:
{{{
#!python
from sqlalchemy import *
m = MetaData()
t1 = Table('t1', m, Column('x', Integer))
t1a = t1.select().alias()
t2 = Table('t2', m, Column('y', Integer, ForeignKey(t1a.c.x)))
print repr(t2)
}}}
in 0.8:
{{{
File "/Users/classic/tmp/sa084/lib/sqlalchemy/schema.py", line 1337, in
__repr__
return "ForeignKey(%r)" % self._get_colspec()
File "/Users/classic/tmp/sa084/lib/sqlalchemy/schema.py", line 1387, in
_get_colspec
return "%s.%s" % (_column.table.fullname, _column.key)
AttributeError: 'Alias' object has no attribute 'fullname'
}}}
in 0.9, that error would happen, but is blocked by this:
{{{
File "/Users/classic/dev/sqlalchemy/lib/sqlalchemy/sql/schema.py", line
1635, in _set_table
self.constraint._set_parent_with_dispatch(table)
File "/Users/classic/dev/sqlalchemy/lib/sqlalchemy/sql/base.py", line
171, in _set_parent_with_dispatch
self._set_parent(parent)
File "/Users/classic/dev/sqlalchemy/lib/sqlalchemy/sql/schema.py", line
2444, in _set_parent
self._validate_dest_table(table)
File "/Users/classic/dev/sqlalchemy/lib/sqlalchemy/sql/schema.py", line
2417, in _validate_dest_table
table_keys = set([elem._table_key() for elem in
self._elements.values()])
File "/Users/classic/dev/sqlalchemy/lib/sqlalchemy/sql/schema.py", line
1475, in _table_key
return _column.table.key
AttributeError: 'Alias' object has no attribute 'key'
}}}
patch:
{{{
#!diff
diff --git a/lib/sqlalchemy/sql/schema.py b/lib/sqlalchemy/sql/schema.py
index 7bf543a..ec1d430 100644
--- a/lib/sqlalchemy/sql/schema.py
+++ b/lib/sqlalchemy/sql/schema.py
@@ -1340,6 +1340,7 @@ class ForeignKey(SchemaItem):
"""
self._colspec = column
+ self._setup_colspec_arg(column)
# the linked ForeignKeyConstraint.
# ForeignKey will create this when parent Column
@@ -1389,6 +1390,27 @@ class ForeignKey(SchemaItem):
)
return self._schema_item_copy(fk)
+ def _setup_colspec_arg(self, _colspec):
+ if isinstance(self._colspec, util.string_types):
+ self._table_column = None
+ return
+ elif hasattr(self._colspec, '__clause_element__'):
+ _column = self._colspec.__clause_element__()
+ else:
+ _column = self._colspec
+
+ if not isinstance(_column, ColumnClause):
+ raise exc.ArgumentError(
+ "String, Column, or Column-bound argument "
+ "expected, got %r" % _column)
+ elif not isinstance(_column.table, (util.NoneType, TableClause)):
+ raise exc.ArgumentError(
+ "ForeignKey received Column not bound "
+ "to a Table, got: %r" % _column.table
+ )
+ self._table_column = _column
+
+
def _get_colspec(self, schema=None):
"""Return a string based 'column specification' for this
:class:`.ForeignKey`.
@@ -1398,16 +1420,25 @@ class ForeignKey(SchemaItem):
"""
if schema:
- return schema + "." + self.column.table.name + \
- "." + self.column.key
- elif isinstance(self._colspec, util.string_types):
+ _schema, tname, colname = self._column_tokens
+ return "%s.%s.%s" % (schema, tname, colname)
+ elif self._table_column is not None:
+ return "%s.%s" % (
+ self._table_column.table.fullname,
self._table_column.key)
+ else:
return self._colspec
- elif hasattr(self._colspec, '__clause_element__'):
- _column = self._colspec.__clause_element__()
+
+
+ def _table_key(self):
+ if self._table_column is not None:
+ if self._table_column.table is None:
+ return None
+ else:
+ return self._table_column.table.key
else:
- _column = self._colspec
+ schema, tname, colname = self._column_tokens
+ return _get_table_key(tname, schema)
- return "%s.%s" % (_column.table.fullname, _column.key)
target_fullname = property(_get_colspec)
@@ -1460,20 +1491,6 @@ class ForeignKey(SchemaItem):
schema = None
return schema, tname, colname
- def _table_key(self):
- if isinstance(self._colspec, util.string_types):
- schema, tname, colname = self._column_tokens
- return _get_table_key(tname, schema)
- elif hasattr(self._colspec, '__clause_element__'):
- _column = self._colspec.__clause_element__()
- else:
- _column = self._colspec
-
- if _column.table is None:
- return None
- else:
- return _column.table.key
-
def _resolve_col_tokens(self):
if self.parent is None:
raise exc.InvalidRequestError(
}}}
--
--
Ticket URL: <http://www.sqlalchemy.org/trac/ticket/2883#comment:1>
sqlalchemy <http://www.sqlalchemy.org/>
The Database Toolkit for Python
|
|
From: sqlalchemy <mi...@zz...> - 2013-12-09 16:45:02
|
#2883: foreign key to a non-table doesn't raise (correctly, consistently)
--------------------+---------------------------------------
Reporter: zzzeek | Owner: zzzeek
Type: defect | Status: new
Priority: high | Milestone: 0.9.0
Component: schema | Severity: minor - half an hour
Keywords: | Progress State: needs tests
--------------------+---------------------------------------
{{{
#!python
from sqlalchemy import *
m = MetaData()
t1 = Table('t1', m, Column('x', Integer))
t1a = t1.select().alias()
t2 = Table('t2', m, Column('y', Integer, ForeignKey(t1a.c.x)))
print repr(t2)}}}
in 0.8:
{{{
File "/Users/classic/tmp/sa084/lib/sqlalchemy/schema.py", line 1337, in
__repr__
return "ForeignKey(%r)" % self._get_colspec()
File "/Users/classic/tmp/sa084/lib/sqlalchemy/schema.py", line 1387, in
_get_colspec
return "%s.%s" % (_column.table.fullname, _column.key)
AttributeError: 'Alias' object has no attribute 'fullname'
}}}
in 0.9, that error would happen, but is blocked by this:
{{{
File "/Users/classic/dev/sqlalchemy/lib/sqlalchemy/sql/schema.py", line
1635, in _set_table
self.constraint._set_parent_with_dispatch(table)
File "/Users/classic/dev/sqlalchemy/lib/sqlalchemy/sql/base.py", line
171, in _set_parent_with_dispatch
self._set_parent(parent)
File "/Users/classic/dev/sqlalchemy/lib/sqlalchemy/sql/schema.py", line
2444, in _set_parent
self._validate_dest_table(table)
File "/Users/classic/dev/sqlalchemy/lib/sqlalchemy/sql/schema.py", line
2417, in _validate_dest_table
table_keys = set([elem._table_key() for elem in
self._elements.values()])
File "/Users/classic/dev/sqlalchemy/lib/sqlalchemy/sql/schema.py", line
1475, in _table_key
return _column.table.key
AttributeError: 'Alias' object has no attribute 'key'
}}}
patch:
{{{
#!diff
diff --git a/lib/sqlalchemy/sql/schema.py b/lib/sqlalchemy/sql/schema.py
index 7bf543a..ec1d430 100644
--- a/lib/sqlalchemy/sql/schema.py
+++ b/lib/sqlalchemy/sql/schema.py
@@ -1340,6 +1340,7 @@ class ForeignKey(SchemaItem):
"""
self._colspec = column
+ self._setup_colspec_arg(column)
# the linked ForeignKeyConstraint.
# ForeignKey will create this when parent Column
@@ -1389,6 +1390,27 @@ class ForeignKey(SchemaItem):
)
return self._schema_item_copy(fk)
+ def _setup_colspec_arg(self, _colspec):
+ if isinstance(self._colspec, util.string_types):
+ self._table_column = None
+ return
+ elif hasattr(self._colspec, '__clause_element__'):
+ _column = self._colspec.__clause_element__()
+ else:
+ _column = self._colspec
+
+ if not isinstance(_column, ColumnClause):
+ raise exc.ArgumentError(
+ "String, Column, or Column-bound argument "
+ "expected, got %r" % _column)
+ elif not isinstance(_column.table, (util.NoneType, TableClause)):
+ raise exc.ArgumentError(
+ "ForeignKey received Column not bound "
+ "to a Table, got: %r" % _column.table
+ )
+ self._table_column = _column
+
+
def _get_colspec(self, schema=None):
"""Return a string based 'column specification' for this
:class:`.ForeignKey`.
@@ -1398,16 +1420,25 @@ class ForeignKey(SchemaItem):
"""
if schema:
- return schema + "." + self.column.table.name + \
- "." + self.column.key
- elif isinstance(self._colspec, util.string_types):
+ _schema, tname, colname = self._column_tokens
+ return "%s.%s.%s" % (schema, tname, colname)
+ elif self._table_column is not None:
+ return "%s.%s" % (
+ self._table_column.table.fullname,
self._table_column.key)
+ else:
return self._colspec
- elif hasattr(self._colspec, '__clause_element__'):
- _column = self._colspec.__clause_element__()
+
+
+ def _table_key(self):
+ if self._table_column is not None:
+ if self._table_column.table is None:
+ return None
+ else:
+ return self._table_column.table.key
else:
- _column = self._colspec
+ schema, tname, colname = self._column_tokens
+ return _get_table_key(tname, schema)
- return "%s.%s" % (_column.table.fullname, _column.key)
target_fullname = property(_get_colspec)
@@ -1460,20 +1491,6 @@ class ForeignKey(SchemaItem):
schema = None
return schema, tname, colname
- def _table_key(self):
- if isinstance(self._colspec, util.string_types):
- schema, tname, colname = self._column_tokens
- return _get_table_key(tname, schema)
- elif hasattr(self._colspec, '__clause_element__'):
- _column = self._colspec.__clause_element__()
- else:
- _column = self._colspec
-
- if _column.table is None:
- return None
- else:
- return _column.table.key
-
def _resolve_col_tokens(self):
if self.parent is None:
raise exc.InvalidRequestError(
}}}
--
Ticket URL: <http://www.sqlalchemy.org/trac/ticket/2883>
sqlalchemy <http://www.sqlalchemy.org/>
The Database Toolkit for Python
|
|
From: sqlalchemy <mi...@zz...> - 2013-12-08 19:31:30
|
#2882: literal binds for text()
------------------------------+----------------------------------
Reporter: zzzeek | Owner: zzzeek
Type: defect | Status: new
Priority: high | Milestone: 0.9.0
Component: sql | Severity: minor - half an hour
Resolution: | Keywords:
Progress State: needs tests |
------------------------------+----------------------------------
Changes (by zzzeek):
* priority: medium => high
Comment:
for 0.9 along with #2651
--
Ticket URL: <http://www.sqlalchemy.org/trac/ticket/2882#comment:1>
sqlalchemy <http://www.sqlalchemy.org/>
The Database Toolkit for Python
|
|
From: sqlalchemy <mi...@zz...> - 2013-12-08 19:31:14
|
#2651: provide a "no-bind-param" version of Text() and apply this to DDL
------------------------------+----------------------------------
Reporter: gthb | Owner: zzzeek
Type: enhancement | Status: new
Priority: high | Milestone: 0.9.0
Component: schema | Severity: minor - half an hour
Resolution: | Keywords:
Progress State: needs tests |
------------------------------+----------------------------------
Changes (by zzzeek):
* priority: medium => high
* milestone: 0.8.xx => 0.9.0
* severity: major - 1-3 hours => minor - half an hour
* status_field: in queue => needs tests
Comment:
it seems like `CheckConstraint` is the only place in the schema system
that we have any implicit construction of `text()`.
Here's a solution taht adds a new `RawText` construct:
{{{
#!diff
diff --git a/lib/sqlalchemy/sql/compiler.py
b/lib/sqlalchemy/sql/compiler.py
index 0c25208..cd79db0 100644
--- a/lib/sqlalchemy/sql/compiler.py
+++ b/lib/sqlalchemy/sql/compiler.py
@@ -599,6 +599,9 @@ class SQLCompiler(Compiled):
self.post_process_text(textclause.text))
)
+ def visit_raw_text(self, rawtext, **kw):
+ return self.post_process_text(rawtext.text)
+
def visit_text_as_from(self, taf, iswrapper=False,
compound_index=0, force_result_map=False,
asfrom=False,
diff --git a/lib/sqlalchemy/sql/elements.py
b/lib/sqlalchemy/sql/elements.py
index 045056b..11a55d9 100644
--- a/lib/sqlalchemy/sql/elements.py
+++ b/lib/sqlalchemy/sql/elements.py
@@ -883,6 +883,17 @@ class TypeClause(ClauseElement):
self.type = type
+class RawText(ClauseElement):
+ """Represent literal SQL text with no bind or type processing.
+
+ """
+
+ __visit_name__ = 'raw_text'
+
+ def __init__(self, text):
+ self.text = text
+
+
class TextClause(Executable, ClauseElement):
"""Represent a literal SQL text fragment.
@@ -2716,13 +2727,13 @@ def _clause_element_as_expr(element):
return element
-def _literal_as_text(element):
+def _literal_as_text(element, textcls=TextClause):
if isinstance(element, Visitable):
return element
elif hasattr(element, '__clause_element__'):
return element.__clause_element__()
elif isinstance(element, util.string_types):
- return TextClause(util.text_type(element))
+ return textcls(util.text_type(element))
elif isinstance(element, (util.NoneType, bool)):
return _const_expr(element)
else:
diff --git a/lib/sqlalchemy/sql/schema.py b/lib/sqlalchemy/sql/schema.py
index 7bf543a..da217e4 100644
--- a/lib/sqlalchemy/sql/schema.py
+++ b/lib/sqlalchemy/sql/schema.py
@@ -37,7 +37,8 @@ from . import type_api
from .base import _bind_or_error, ColumnCollection
from .elements import ClauseElement, ColumnClause, _truncated_label, \
_as_truncated, TextClause, _literal_as_text,\
- ColumnElement, _find_columns, quoted_name
+ ColumnElement, _find_columns, quoted_name, \
+ RawText
from .selectable import TableClause
import collections
import sqlalchemy
@@ -62,6 +63,10 @@ def _validate_dialect_kwargs(kwargs, name):
raise TypeError("Additional arguments should be "
"named <dialectname>_<argument>, got '%s'" % k)
+def _literal_as_ddl(element):
+ return _literal_as_text(element, textcls=RawText)
+
+
@inspection._self_inspects
class SchemaItem(SchemaEventTarget, visitors.Visitable):
"""Base class for items that define a database schema."""
@@ -2276,7 +2281,7 @@ class CheckConstraint(Constraint):
super(CheckConstraint, self).\
__init__(name, deferrable, initially,
_create_rule)
- self.sqltext = _literal_as_text(sqltext)
+ self.sqltext = _literal_as_ddl(sqltext)
if table is not None:
self._set_parent_with_dispatch(table)
elif _autoattach:
}}}
this is for 0.9 along with #2882.
--
Ticket URL: <http://www.sqlalchemy.org/trac/ticket/2651#comment:3>
sqlalchemy <http://www.sqlalchemy.org/>
The Database Toolkit for Python
|
|
From: sqlalchemy <mi...@zz...> - 2013-12-08 19:18:00
|
#2882: literal binds for text()
--------------------+---------------------------------------
Reporter: zzzeek | Owner: zzzeek
Type: defect | Status: new
Priority: medium | Milestone: 0.9.0
Component: sql | Severity: minor - half an hour
Keywords: | Progress State: needs tests
--------------------+---------------------------------------
not sure if this is for 0.8 or not
{{{
#!python
from sqlalchemy import *
from sqlalchemy.dialects import sqlite
t = text("select * where x = :bind").bindparams(bind='x')
print t.compile(dialect=sqlite.dialect(), compile_kwargs={"literal_binds":
True})
}}}
should print:
{{{
select * where x = 'x'
}}}
{{{
#!diff
diff --git a/lib/sqlalchemy/sql/compiler.py
b/lib/sqlalchemy/sql/compiler.py
index 0c25208..3c8d713 100644
--- a/lib/sqlalchemy/sql/compiler.py
+++ b/lib/sqlalchemy/sql/compiler.py
@@ -585,13 +585,13 @@ class SQLCompiler(Compiled):
def post_process_text(self, text):
return text
- def visit_textclause(self, textclause, **kwargs):
+ def visit_textclause(self, textclause, **kw):
def do_bindparam(m):
name = m.group(1)
if name in textclause._bindparams:
- return self.process(textclause._bindparams[name])
+ return self.process(textclause._bindparams[name], **kw)
else:
- return self.bindparam_string(name, **kwargs)
+ return self.bindparam_string(name, **kw)
# un-escape any \:params
return BIND_PARAMS_ESC.sub(lambda m: m.group(1),
}}}
--
Ticket URL: <http://www.sqlalchemy.org/trac/ticket/2882>
sqlalchemy <http://www.sqlalchemy.org/>
The Database Toolkit for Python
|
|
From: sqlalchemy <mi...@zz...> - 2013-12-08 19:05:38
|
#2246: doc TODOs
-----------------------------------+---------------------------------------
Reporter: zzzeek | Owner: zzzeek
Type: task | Status: closed
Priority: medium | Milestone: 0.8.xx
Component: documentation | Severity: very major - up to 2 days
Resolution: fixed | Keywords:
Progress State: completed/closed |
-----------------------------------+---------------------------------------
Changes (by zzzeek):
* status: new => closed
* resolution: => fixed
* status_field: in progress => completed/closed
Comment:
this ticket is too vague and unlinked to current documentation progress.
adding examples to docstrings is most of what's not done here and that's a
much bigger and more long term project than just a few items here.
--
Ticket URL: <http://www.sqlalchemy.org/trac/ticket/2246#comment:6>
sqlalchemy <http://www.sqlalchemy.org/>
The Database Toolkit for Python
|
|
From: sqlalchemy <mi...@zz...> - 2013-12-07 23:39:31
|
#2875: attempt to improve the system by which engine_from_config locates keys w/
special values
-----------------------------------+----------------------------------
Reporter: zzzeek | Owner: zzzeek
Type: enhancement | Status: closed
Priority: high | Milestone: 0.9.0
Component: engine | Severity: minor - half an hour
Resolution: fixed | Keywords:
Progress State: completed/closed |
-----------------------------------+----------------------------------
Changes (by zzzeek):
* status: new => closed
* resolution: => fixed
* status_field: in queue => completed/closed
Comment:
r49d80269878c9d793df752479c876c
--
Ticket URL: <http://www.sqlalchemy.org/trac/ticket/2875#comment:2>
sqlalchemy <http://www.sqlalchemy.org/>
The Database Toolkit for Python
|
|
From: sqlalchemy <mi...@zz...> - 2013-12-07 23:04:00
|
#2816: clean up identity_key util documentation
-----------------------------------+----------------------------------
Reporter: zzzeek | Owner: zzzeek
Type: defect | Status: closed
Priority: high | Milestone: 0.8.xx
Component: documentation | Severity: minor - half an hour
Resolution: fixed | Keywords:
Progress State: completed/closed |
-----------------------------------+----------------------------------
Changes (by zzzeek):
* status: new => closed
* resolution: => fixed
* status_field: in queue => completed/closed
Comment:
r6817592180ac2ecd52d543029431f3f803967ce6 0.8
r7af17459ca23bbf7afcb2bf53531a9e029e05175 master / 0.9
--
Ticket URL: <http://www.sqlalchemy.org/trac/ticket/2816#comment:2>
sqlalchemy <http://www.sqlalchemy.org/>
The Database Toolkit for Python
|
|
From: sqlalchemy <mi...@zz...> - 2013-12-07 22:38:55
|
#2862: dogpile helloworld is all wrong
-----------------------------------+----------------------------------
Reporter: zzzeek | Owner: zzzeek
Type: defect | Status: closed
Priority: highest | Milestone: 0.8.xx
Component: documentation | Severity: minor - half an hour
Resolution: fixed | Keywords:
Progress State: completed/closed |
-----------------------------------+----------------------------------
Changes (by zzzeek):
* status: new => closed
* resolution: => fixed
* status_field: in queue => completed/closed
Comment:
r7e78fb05c75193bce7111626d464507404b55fa1 0.8
r5517c0eef9a1c4228d976584d7d6 master 0.9
--
Ticket URL: <http://www.sqlalchemy.org/trac/ticket/2862#comment:1>
sqlalchemy <http://www.sqlalchemy.org/>
The Database Toolkit for Python
|
|
From: sqlalchemy <mi...@zz...> - 2013-12-07 22:25:07
|
#2881: error handler on connect handles non-DBAPI exceptions incorrectly
-----------------------------------+----------------------------------
Reporter: zzzeek | Owner: zzzeek
Type: defect | Status: closed
Priority: high | Milestone: 0.8.xx
Component: engine | Severity: minor - half an hour
Resolution: fixed | Keywords:
Progress State: completed/closed |
-----------------------------------+----------------------------------
Changes (by zzzeek):
* status: new => closed
* resolution: => fixed
* status_field: in progress => completed/closed
Comment:
rb113202eecd7360bf41ecc8eeca1dd120cc30567 0.8
r6d5eae78a7dd79ad7bd0a0951bc6c95437d0fa8e master / 0.9
--
Ticket URL: <http://www.sqlalchemy.org/trac/ticket/2881#comment:1>
sqlalchemy <http://www.sqlalchemy.org/>
The Database Toolkit for Python
|
|
From: sqlalchemy <mi...@zz...> - 2013-12-07 22:07:38
|
#2715: add more explicit documentation/flags for the many gaerdbms DBAPI options
-----------------------------------+--------------------------------------
Reporter: moraes | Owner: zzzeek
Type: enhancement | Status: closed
Priority: medium | Milestone: 0.8.xx
Component: mysql | Severity: minor - half an hour
Resolution: fixed | Keywords: gaerdbms, mysql, dialect
Progress State: completed/closed |
-----------------------------------+--------------------------------------
Comment (by zzzeek):
Hm well, yes, we really need dbapi.Error at least to handle this. So I
guess that makes it very hard to work around this without putting all
kinds of hardcoded assumptions in the dialect. Google's API should be
raising ImportError immediately when it's imported.
--
Ticket URL: <http://www.sqlalchemy.org/trac/ticket/2715#comment:14>
sqlalchemy <http://www.sqlalchemy.org/>
The Database Toolkit for Python
|
|
From: sqlalchemy <mi...@zz...> - 2013-12-07 21:46:33
|
#2715: add more explicit documentation/flags for the many gaerdbms DBAPI options
-----------------------------------+--------------------------------------
Reporter: moraes | Owner: zzzeek
Type: enhancement | Status: closed
Priority: medium | Milestone: 0.8.xx
Component: mysql | Severity: minor - half an hour
Resolution: fixed | Keywords: gaerdbms, mysql, dialect
Progress State: completed/closed |
-----------------------------------+--------------------------------------
Comment (by zzzeek):
OK well the NotImplementedError should not be getting fed into
is_disconnect(), nor the wrapping of Error, that's a bug. The normal
place this happens is in engine/base.py in _handle_dbapi_exception(), but
I see the one in strategies.py isn't doing that, so that's broke. that's
#2881, so it'll be fixed.
--
Ticket URL: <http://www.sqlalchemy.org/trac/ticket/2715#comment:13>
sqlalchemy <http://www.sqlalchemy.org/>
The Database Toolkit for Python
|
|
From: sqlalchemy <mi...@zz...> - 2013-12-07 21:46:20
|
#2881: error handler on connect handles non-DBAPI exceptions incorrectly
--------------------+---------------------------------------
Reporter: zzzeek | Owner: zzzeek
Type: defect | Status: new
Priority: high | Milestone: 0.8.xx
Component: engine | Severity: minor - half an hour
Keywords: | Progress State: in progress
--------------------+---------------------------------------
{{{
#!python
from mock import Mock
from sqlalchemy import create_engine
import sqlite3 as dbapi
def _not_impl(*arg, **kw):
raise NotImplementedError()
e = create_engine("sqlite://", module=dbapi)
c = e.connect()
c.connection.cursor = Mock(return_value=Mock(execute=_not_impl))
try:
c.execute("select 1")
except NotImplementedError:
pass
e = create_engine("sqlite://", module=dbapi)
dbapi.connect = _not_impl
try:
e.connect()
except NotImplementedError:
pass
}}}
--
Ticket URL: <http://www.sqlalchemy.org/trac/ticket/2881>
sqlalchemy <http://www.sqlalchemy.org/>
The Database Toolkit for Python
|
|
From: sqlalchemy <mi...@zz...> - 2013-12-07 17:32:09
|
#2715: add more explicit documentation/flags for the many gaerdbms DBAPI options
-----------------------------------+--------------------------------------
Reporter: moraes | Owner: zzzeek
Type: enhancement | Status: closed
Priority: medium | Milestone: 0.8.xx
Component: mysql | Severity: minor - half an hour
Resolution: fixed | Keywords: gaerdbms, mysql, dialect
Progress State: completed/closed |
-----------------------------------+--------------------------------------
Comment (by mjpieters):
Hrm, not sure how far to go with this; altering the `paramstyle` test
with:
{{{
#!python
if paramstyle is not None:
self.paramstyle = paramstyle
elif self.dbapi is not None and hasattr(self.dbapi, 'paramstyle'):
self.paramstyle = self.dbapi.paramstyle
else:
self.paramstyle = self.default_paramstyle
}}}
inevitably leads to more problems.
What happens in that case is that the `DefaultEngineStrategy.create()`
method tries to call `dialect.connect()` which fails by raising
`NotImplementedError`, as expected. We'd like to propagate that error if
it is not a disconnection exception.
But the MySQL dialect `is_disconnected()` method tries to test exceptions
against `dbapi.OperationalError`, which is of course missing here. If you
override `is_disconnected()` on `MySQLDialect_gaerdbms`, to return `False`
for `NotImplementedError` exceptions, then
`DefaultEngineStrategy.create()` will try and use `dbapi.Error` to re-
raise the exception. Nope, not present either.
So, short of poking in a dummy `dbapi.Error` class, there is no real clean
way to handle this corner case. Instead, I've documented the
[http://stackoverflow.com/questions/20433973/local-mysqldb-connection-
fails-when-running-gae-development-server|exception on Stack Overflow].
The solution is simple anyway, just install the MySQLdb package, as
instructed in the SDK.
--
Ticket URL: <http://www.sqlalchemy.org/trac/ticket/2715#comment:12>
sqlalchemy <http://www.sqlalchemy.org/>
The Database Toolkit for Python
|
|
From: sqlalchemy <mi...@zz...> - 2013-12-07 01:04:14
|
#2715: add more explicit documentation/flags for the many gaerdbms DBAPI options
-----------------------------------+--------------------------------------
Reporter: moraes | Owner: zzzeek
Type: enhancement | Status: closed
Priority: medium | Milestone: 0.8.xx
Component: mysql | Severity: minor - half an hour
Resolution: fixed | Keywords: gaerdbms, mysql, dialect
Progress State: completed/closed |
-----------------------------------+--------------------------------------
Comment (by zzzeek):
OK so if we put a check around .paramstyle, and just let it default to
something like "format", when the program goes to connect theyll get the
NotImplementedError. lets just do that can you send me a PR ?
--
Ticket URL: <http://www.sqlalchemy.org/trac/ticket/2715#comment:11>
sqlalchemy <http://www.sqlalchemy.org/>
The Database Toolkit for Python
|
|
From: sqlalchemy <mi...@zz...> - 2013-12-07 01:00:24
|
#2880: handle case where arbitrary connection is hanging on connect, allow others
to go through
-----------------------------------+-------------------------------
Reporter: zzzeek | Owner: zzzeek
Type: defect | Status: closed
Priority: highest | Milestone: 0.8.xx
Component: pool | Severity: major - 1-3 hours
Resolution: fixed | Keywords:
Progress State: completed/closed |
-----------------------------------+-------------------------------
Changes (by zzzeek):
* status: new => closed
* milestone: 0.9.0 => 0.8.xx
* resolution: => fixed
* status_field: in progress => completed/closed
Comment:
r507a33319f7227a49fff62c4cac7f3f9272e927d 0.8
rd1cc78479d988bd9acbcf395483d2130b0873b1c master
--
Ticket URL: <http://www.sqlalchemy.org/trac/ticket/2880#comment:1>
sqlalchemy <http://www.sqlalchemy.org/>
The Database Toolkit for Python
|
|
From: sqlalchemy <mi...@zz...> - 2013-12-07 00:13:34
|
#2715: add more explicit documentation/flags for the many gaerdbms DBAPI options
-----------------------------------+--------------------------------------
Reporter: moraes | Owner: zzzeek
Type: enhancement | Status: closed
Priority: medium | Milestone: 0.8.xx
Component: mysql | Severity: minor - half an hour
Resolution: fixed | Keywords: gaerdbms, mysql, dialect
Progress State: completed/closed |
-----------------------------------+--------------------------------------
Comment (by mjpieters):
The full implementation of that module is essentially:
{{{
#!python
try:
import google
import MySQLdb
from MySQLdb import *
__import__('MySQLdb.constants', globals(), locals(), ['*'])
except ImportError:
def connect(instance=None, database=None):
logging.error('The rdbms API (Google Cloud SQL) is not available
because '
'the MySQLdb library could not be loaded. Please see the
SDK '
'documentation for installation instructions.')
raise NotImplementedError('Unable to find the MySQLdb library')
else:
def connect(instance=None, database=None, **kwargs):
merged_kwargs = _connect_kwargs.copy()
if database:
merged_kwargs['db'] = database
merged_kwargs.update(kwargs)
if 'password' in merged_kwargs:
merged_kwargs['passwd'] = merged_kwargs.pop('password')
host = merged_kwargs.get('host')
if ((not host or host == 'localhost') and
not merged_kwargs.get('unix_socket') and
_OS_NAME == 'posix'):
}}}
(with the famed Google 2-space indent).
So essentially, all but the `MySQLdb.connect()` method is taken directly
from the `MySQLdb` module. I doubt Google will ever add in a `paramstyle`
attribute here, that is not the bug.
--
Ticket URL: <http://www.sqlalchemy.org/trac/ticket/2715#comment:10>
sqlalchemy <http://www.sqlalchemy.org/>
The Database Toolkit for Python
|
|
From: sqlalchemy <mi...@zz...> - 2013-12-06 22:53:14
|
#2715: add more explicit documentation/flags for the many gaerdbms DBAPI options
-----------------------------------+--------------------------------------
Reporter: moraes | Owner: zzzeek
Type: enhancement | Status: closed
Priority: medium | Milestone: 0.8.xx
Component: mysql | Severity: minor - half an hour
Resolution: fixed | Keywords: gaerdbms, mysql, dialect
Progress State: completed/closed |
-----------------------------------+--------------------------------------
Comment (by zzzeek):
but then if gaerdbms fixes that bug it's sort of legacy garbage lying
around then, can we determine more specifically what ".paramstyle" missing
means and if there's a more idiomatic way to detect this failure ?
--
Ticket URL: <http://www.sqlalchemy.org/trac/ticket/2715#comment:9>
sqlalchemy <http://www.sqlalchemy.org/>
The Database Toolkit for Python
|
|
From: sqlalchemy <mi...@zz...> - 2013-12-06 22:43:39
|
#2715: add more explicit documentation/flags for the many gaerdbms DBAPI options
-----------------------------------+--------------------------------------
Reporter: moraes | Owner: zzzeek
Type: enhancement | Status: closed
Priority: medium | Milestone: 0.8.xx
Component: mysql | Severity: minor - half an hour
Resolution: fixed | Keywords: gaerdbms, mysql, dialect
Progress State: completed/closed |
-----------------------------------+--------------------------------------
Comment (by mjpieters):
I initially mistook this as a bug with either the GAE SDK or SQLAlchemy
bug, but at best it is an unfortunate interaction. In the `rdbms_mysql`
module, if `import MySQLdb` fails, `connect` is defined as:
{{{
#!python
def connect(instance=None, database=None):
logging.error('The rdbms API (Google Cloud SQL) is not available
because '
'the MySQLdb library could not be loaded. Please see the
SDK '
'documentation for installation instructions.')
raise NotImplementedError('Unable to find the MySQLdb library')
}}}
so connecting will raise an exception, but `paramstyle` and other
parameters, normally imported with `from MySQLdb import *`, are naturally
missing.
If you are feeling generous, perhaps the
`sqlalchemy.dialects.mysql.gaerdbms:MySQLDialect_gaerdbms.dbapi()` class
method could verify `paramstyle` is present and raise an `ImportError`
exception if not available.
--
Ticket URL: <http://www.sqlalchemy.org/trac/ticket/2715#comment:8>
sqlalchemy <http://www.sqlalchemy.org/>
The Database Toolkit for Python
|
|
From: sqlalchemy <mi...@zz...> - 2013-12-06 21:39:38
|
#2715: add more explicit documentation/flags for the many gaerdbms DBAPI options
-----------------------------------+--------------------------------------
Reporter: moraes | Owner: zzzeek
Type: enhancement | Status: closed
Priority: medium | Milestone: 0.8.xx
Component: mysql | Severity: minor - half an hour
Resolution: fixed | Keywords: gaerdbms, mysql, dialect
Progress State: completed/closed |
-----------------------------------+--------------------------------------
Comment (by zzzeek):
so what do you suggest?
--
Ticket URL: <http://www.sqlalchemy.org/trac/ticket/2715#comment:7>
sqlalchemy <http://www.sqlalchemy.org/>
The Database Toolkit for Python
|
|
From: sqlalchemy <mi...@zz...> - 2013-12-06 21:35:41
|
#2522: Race condition causing stuck connections when the database goes down
-----------------------------------+-------------------------------
Reporter: gombasg | Owner: zzzeek
Type: defect | Status: closed
Priority: high | Milestone: 0.7.9
Component: pool | Severity: major - 1-3 hours
Resolution: fixed | Keywords:
Progress State: completed/closed |
-----------------------------------+-------------------------------
Comment (by zzzeek):
More adjustments made for 0.8.4, 0.9.0b2, as we've observed the test here
failing sporadically for quite some time:
- Made a slight adjustment to the logic which waits for a pooled
connection to be available, such that for a connection pool
with no timeout specified, it will every half a second break out of
the wait to check for the so-called "abort" flag, which allows the
waiter to break out in case the whole connection pool was dumped;
normally the waiter should break out due to a notify_all() but it's
possible this notify_all() is missed in very slim cases.
This is an extension of logic first introduced in 0.8.0, and the
issue has only been observed occasionally in stress tests.
master/0.9/0.8
r300264ab38def29a4a24a83b39aece0d0332e83d
r003b288b7644d8c39a13ac488ba56356c6375233
r661b1158b44f340083e3154e5870a5067f31bc03
--
Ticket URL: <http://www.sqlalchemy.org/trac/ticket/2522#comment:9>
sqlalchemy <http://www.sqlalchemy.org/>
The Database Toolkit for Python
|
|
From: sqlalchemy <mi...@zz...> - 2013-12-06 20:28:58
|
#2715: add more explicit documentation/flags for the many gaerdbms DBAPI options
-----------------------------------+--------------------------------------
Reporter: moraes | Owner: zzzeek
Type: enhancement | Status: closed
Priority: medium | Milestone: 0.8.xx
Component: mysql | Severity: minor - half an hour
Resolution: fixed | Keywords: gaerdbms, mysql, dialect
Progress State: completed/closed |
-----------------------------------+--------------------------------------
Comment (by mjpieters):
Heads-up: There is a problem with the `rdbms_mysqldb` module, in that it
has no `paramstyle` attribute:
{{{
#!python
# initial lines omitted to protect the easily bored..
File
"/Users/mj/Development/Projects/zagat_personalisation/app/distlib/sqlalchemy/engine/__init__.py",
line 332, in create_engine
return strategy.create(*args, **kwargs)
File
"/Users/mj/Development/Projects/zagat_personalisation/app/distlib/sqlalchemy/engine/strategies.py",
line 69, in create
dialect = dialect_cls(**dialect_args)
File
"/Users/mj/Development/Projects/zagat_personalisation/app/distlib/sqlalchemy/dialects/mysql/base.py",
line 1986, in __init__
default.DefaultDialect.__init__(self, **kwargs)
File
"/Users/mj/Development/Projects/zagat_personalisation/app/distlib/sqlalchemy/engine/default.py",
line 124, in __init__
self.paramstyle = self.dbapi.paramstyle
AttributeError: 'module' object has no attribute 'paramstyle'
}}}
Tested with GAE SDK 1.8.8.
This probably should be reported to Google, but I thought I'd mention this
here too.
--
Ticket URL: <http://www.sqlalchemy.org/trac/ticket/2715#comment:6>
sqlalchemy <http://www.sqlalchemy.org/>
The Database Toolkit for Python
|