"""
    red = DARedis()
    red.zadd(redis_panel_emails_key, {email: datetime.now().timestamp()})


def potential_panelists() -> Iterable[Tuple[str, datetime]]:
    red = DARedis()
    return [(item, datetime.fromtimestamp(score)) for item, score in
            red.zrange(redis_panel_emails_key, 0, -1, withscores=True)]


###################################
## Using SQLAlchemy to save / retrieve session information that is linked
## to specific feedback issues

db_url = alchemy_url("db")
engine = create_engine(db_url)

metadata_obj = MetaData()

## This table functions as both storage for bug report-session links,
## and for more general on-server feedback, prompted for at the end of interviews
feedback_session_table = Table(
    "feedback_session",
    metadata_obj,
    Column("id", Integer, primary_key=True),
    Column("interview", String),
    Column("session_id", String),
    Column("body", Text),
    Column("html_url", String),
)
Beispiel #2
0
    last_name = Column(String(250))
    address = Column(String(250))
    unit = Column(String(250))
    city = Column(String(250))
    state = Column(String(250))
    zip = Column(String(250))

# SQLAlchemy table definition for keeping track of which Banks have which Customers
class BankCustomerModel(Base):
    __tablename__ = 'bank_customer'
    id = Column(Integer, primary_key=True)
    bank_id = Column(Integer, ForeignKey('bank.id', ondelete='CASCADE'), nullable=False)
    customer_id = Column(Integer, ForeignKey('customer.id', ondelete='CASCADE'), nullable=False)

# Form the URL for connecting to the database based on the "demo db" directive in the Configuration
url = alchemy_url('demo db')

# Build the "engine" for connecting to the SQL server, using the URL for the database.
engine = create_engine(url)

# Create the tables 
Base.metadata.create_all(engine)

# Get SQLAlchemy ready
Base.metadata.bind = engine
DBSession = sessionmaker(bind=engine)()

# Perform any necessary database schema updates using alembic, if there is an alembic
# directory and alembic.ini file in the package.
upgrade_db(url, __file__, engine)

# SQLAlchemy table definition for keeping track of which Banks have which Customers
class ProcessoRequeridoModel(Base):
    __tablename__ = 'processo_requerido'
    id = Column(Integer, primary_key=True)
    processo_id = Column(Integer,
                         ForeignKey('processo.id', ondelete='CASCADE'),
                         nullable=False)
    requerido_id = Column(Integer,
                          ForeignKey('requerido.id', ondelete='CASCADE'),
                          nullable=False)


# Form the URL for connecting to the database based on the "demo db" directive in the Configuration
url = alchemy_url('olhosdamata db')

# Build the "engine" for connecting to the SQL server, using the URL for the database.
engine = create_engine(url)

# Create the tables
Base.metadata.create_all(engine)

# Get SQLAlchemy ready
Base.metadata.bind = engine
DBSession = sessionmaker(bind=engine)()

# Perform any necessary database schema updates using alembic, if there is an alembic
# directory and alembic.ini file in the package.
upgrade_db(url, __file__, engine)