Ejemplo n.º 1
0
def getPictureInfo(column: str, value: str) -> bool:
    sql(TypicalWhereSelect.format("*", picturesTable, column, value))
    tempRes = instance.use_result()
    if tempRes.fetch_row():
        return True
    else:
        return False
Ejemplo n.º 2
0
def getPubic(ID: str) -> str:
    """Check if picture is public """
    sql(
        TypicalWhereSelect.format(PRIVATE_POLICY_VOL, picturesTable, ID_COL,
                                  ID))
    tempRes = instance.use_result()
    res = str(tempRes.fetch_row()[0][0])
    return res
Ejemplo n.º 3
0
def getListOfUserS3Keys(userID: str):
    """Return list of picture S3 keys"""
    sql(
        TypicalWhereSelect.format(KEY_IN_S3_COL, picturesTable, USER_ID_COL,
                                  userID))
    tempRes = instance.use_result()
    output = []
    for x in tempRes.fetch_row(0):
        output.append(str(x[0])[2:-1])
    return output
Ejemplo n.º 4
0
def getOwnerNamebyPictureID(ID: str) -> str:
    """ Finds picture's owner Name"""
    sql(TypicalWhereSelect.format(USER_NAME_COL, picturesTable, ID_COL, ID))
    tempRes = instance.use_result()
    res = str(tempRes.fetch_row()[0][0])[2:-1]
    return res
Ejemplo n.º 5
0
def getIDbyUserID(UserID: str) -> str:
    """ Finds picture's ID corresponding to user """
    sql(TypicalWhereSelect.format(ID_COL, picturesTable, USER_ID_COL, UserID))
    tempRes = instance.use_result()
    res = str(tempRes.fetch_row()[0][0])
    return res
Ejemplo n.º 6
0
def getIDbyS3Key(Key: str) -> str:
    """ Finds ID corresponding to S3_key """
    sql(TypicalWhereSelect.format(ID_COL, picturesTable, KEY_IN_S3_COL, Key))
    tempRes = instance.use_result()
    res = str(tempRes.fetch_row()[0][0])
    return res
Ejemplo n.º 7
0
def getS3KeybyID(ID: str) -> str:
    """ Return picture by ID"""
    sql(TypicalWhereSelect.format(KEY_IN_S3_COL, picturesTable, ID_COL, ID))
    tempRes = instance.use_result()
    res = str(tempRes.fetch_row()[0][0])[2:-1]
    return res
Ejemplo n.º 8
0
def getStringOfUserPictures(userID: str) -> str:
    """Return picture IDs separated by comma"""
    sql(TypicalWhereSelect.format(ID_COL, picturesTable, USER_ID_COL, userID))
    tempRes = instance.use_result()
    output = ", ".join([str(x[0]) for x in tempRes.fetch_row(0)])
    return output