<p dir="auto"><strong>Migrated issue, originally created by Anonymous</strong></p>
<p dir="auto">Attached is a patch that fixes insertion of small decimal numbers in MSSQL</p>
<hr>
<p dir="auto">Attachments: <a href="../wiki/imported_issue_attachments/1282/test_decimal_notation_mssql.diff">test_decimal_notation_mssql.diff</a> | <a href="../wiki/imported_issue_attachments/1282/ms.diff">ms.diff</a> | <a href="../wiki/imported_issue_attachments/1282/decimal_support_mssql_dialect.diff">decimal_support_mssql_dialect.diff</a></p>
<p dir="auto"><strong>Migrated issue, originally created by Pavel Brych</strong></p>
<p dir="auto">After upgrading to 1.0.2 resp. 1.0.3 SQLAlchemy, this error popped up. It happens when label() is used with attribute of aliased entity.</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="#!/usr/bin/python
# -*- coding: utf-8 -*-
from sqlalchemy import *
from sqlalchemy.orm import *
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import aliased

Base = declarative_base()

class User(Base):
    __tablename__ = 'users'

    id = Column(Integer, primary_key=True)
    username = Column(String(255))
    realname = Column(String(255))

e = create_engine(&quot;postgresql://user:passwd@localhost/db_name&quot;, echo=True)
Base.metadata.create_all(e)

session = Session(e)

user = aliased(User,name=&quot;user&quot;)

q = session.query(user.username.label(&quot;username&quot;))

print(q.column_descriptions)"><pre class="notranslate"><code class="notranslate">#!/usr/bin/python
# -*- coding: utf-8 -*-
from sqlalchemy import *
from sqlalchemy.orm import *
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import aliased

Base = declarative_base()

class User(Base):
    __tablename__ = 'users'

    id = Column(Integer, primary_key=True)
    username = Column(String(255))
    realname = Column(String(255))

e = create_engine("postgresql://user:passwd@localhost/db_name", echo=True)
Base.metadata.create_all(e)

session = Session(e)

user = aliased(User,name="user")

q = session.query(user.username.label("username"))

print(q.column_descriptions)
</code></pre></div>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="Traceback (most recent call last):
  File &quot;/home/pavel/python/hores/src/sqlalchemytest.py&quot;, line 27, in &lt;module&gt;
    print(q.column_descriptions)
  File &quot;/usr/lib64/python3.4/site-packages/sqlalchemy/orm/query.py&quot;, line 2583, in column_descriptions
    for ent in self._entities
  File &quot;/usr/lib64/python3.4/site-packages/sqlalchemy/orm/query.py&quot;, line 2583, in &lt;listcomp&gt;
    for ent in self._entities
  File &quot;/usr/lib64/python3.4/site-packages/sqlalchemy/orm/util.py&quot;, line 398, in __getattr__
    raise AttributeError(key)
AttributeError: entity"><pre class="notranslate"><code class="notranslate">Traceback (most recent call last):
  File "/home/pavel/python/hores/src/sqlalchemytest.py", line 27, in &lt;module&gt;
    print(q.column_descriptions)
  File "/usr/lib64/python3.4/site-packages/sqlalchemy/orm/query.py", line 2583, in column_descriptions
    for ent in self._entities
  File "/usr/lib64/python3.4/site-packages/sqlalchemy/orm/query.py", line 2583, in &lt;listcomp&gt;
    for ent in self._entities
  File "/usr/lib64/python3.4/site-packages/sqlalchemy/orm/util.py", line 398, in __getattr__
    raise AttributeError(key)
AttributeError: entity
</code></pre></div>