That worked. My problem is I was using Base.classes.hosts and not the
class Hosts.
On Tue, Aug 30, 2016 at 1:39 AM, Simon King wrote:
> Which line is triggering that error?
>
> Here's a working example:
>
> import sqlalchemy as sa
> import sqlalchemy.orm as saorm
> from
Which line is triggering that error?
Here's a working example:
import sqlalchemy as sa
import sqlalchemy.orm as saorm
from sqlalchemy.ext.automap import automap_base
Base = automap_base()
class Host(Base):
__tablename__ = 'hosts'
_mac_address = sa.Column('mac_address', sa.Integer)
When I try to do that I get
File
"/home/CORP/robert.minsk/venvs/lfw/lib/python2.7/site-packages/sqlalchemy/util/_collections.py",
line 212, in __getattr__
raise AttributeError(key)
AttributeError: hosts
On Fri, Aug 26, 2016 at 1:33 AM, Simon King wrote:
> On Fri,
On Fri, Aug 26, 2016 at 2:24 AM, Robert Minsk wrote:
> I am using automap_base to reflect a table.
>
> metadata = MetaData()
> metadata.reflect(bind=engine, only=['hosts'])
> automap = automap_base(metadata=metadata)
> automap.prepare()
>
> Hosts = automap.classes.hosts
>
> The
I am using automap_base to reflect a table.
metadata = MetaData()
metadata.reflect(bind=engine, only=['hosts'])
automap = automap_base(metadata=metadata)
automap.prepare()
Hosts = automap.classes.hosts
The mac_address column in Hosts is binary and would like to to replace the
mac_address with