Hi everyone.

I've been experiencing a very weird issue, and I hope someone could help me 
with it.

I've mapped a Redshift table using SQL Alchemy's ORM.

Here is my code.

from sqlalchemy.ext.automap import automap_base
from sqlalchemy import Column, Integer, String, ForeignKey
from sqlalchemy import create_engine
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import sessionmaker
import psycopg2


user = ""
passwd = ""
host = ""
    
engine = create_engine('postgresql+psycopg2://{}:{}{}'.format(user,passwd,
host))
########################################################################
Base = automap_base()


class Bookmarks(Base):
    __tablename__ = 'my_table'
    __table_args__ = {"schema":"dev"}
    
    agent_id = Column(Integer, primary_key=True)
    username = Column(String)
    email = Column(String)
    first_name = Column(String)
    last_name = Column(String)
    role_id = Column(Integer)
    role = Column(String)
    team = Column(String)
    access_level = Column(String)
    location = Column(String)    


def loadSession():
    """"""
    metadata = Base.metadata
    Session = sessionmaker(bind=engine)
    session = Session()
    return session


Base.prepare()
session = loadSession()
res = session.query(Bookmarks).all()


Everything works fine after executing the code. The problem is that it 
looks like it's been interacting weirdly with AWS. I've been creating 
tables to test this out, and it seems like everytime I map a Redshift table 
using this code, the table becomes totally unresponsive. I'm able to query 
it using SQLAlchemy, but if I try to alter it, or delete it, it will 
literally take a hour before getting a response. 

I'm not getting any errors, it's just that everything becomes very slow. 
The tables are very small, so this shouldn't be happening.

Has anyone experienced this issue? 




-- 
SQLAlchemy - 
The Python SQL Toolkit and Object Relational Mapper

http://www.sqlalchemy.org/

To post example code, please provide an MCVE: Minimal, Complete, and Verifiable 
Example.  See  http://stackoverflow.com/help/mcve for a full description.
--- 
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sqlalchemy+unsubscr...@googlegroups.com.
To post to this group, send email to sqlalchemy@googlegroups.com.
Visit this group at https://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.

Reply via email to