SQLAlchemy Aliase not instantiating constructor value

48 views Asked by At

Recently we have migrated to newer latest version of SQLAlchemy. Below code was working without any issue in old version.

My class:

from redshift.classpath import HomePod

class User(HomePod):
__tablename__ = 'user'

customeraccountid = Column(BIGINT, primary_key=True)
tenantid = Column(BIGINT, primary_key=True)
userid = Column(String(128), primary_key=True)
acceptsmarketing = Column(Boolean)
createby = Column(String(128))
createdate = Column(TIMESTAMP)


__table_args__ = {}

def __init__(self, schema=HomePod): 
      self.__table__.schema = schema

I was using below code:

User_1 = aliased(User(schema='Myschemaname'))

But now, the schema name which I am passing not getting assigned to the class. I have tried below code as well. But no luck.

User_1 = aliased(User)
User_1.schema = 'myschemaname'

Someone please suggest what to do in this situation?

Thanks

0

There are 0 answers