tlx/dynamodb/table.py
def add_key(table, key, item):
    """ If the item doesn't exist yet. Create the key.
        !! Does NOT support tables with Partition and Sort keys Yet.
    """

    key_names = [k for k in key]
    full_item = {**key, **item}  # noqa: E999   - only invalid in old pythons
    logger.debug(f'submitting item: {full_item}')  # noqa: E999   - only invalid in old pythons

    logger.info(f"Attempting to add new record for: {key} ")
    res = table.put_item(
        Item=full_item,
        ConditionExpression=f"attribute_not_exists({key_names[0]})",  # TODO fix for items with Partition and Sort key
    )

    logger.info(f"Successfully added new record.")
    logger.debug(f"{full_item}")
    return res['ResponseMetadata']['HTTPStatusCode']
 If the item doesn't exist yet. Create the key.
        !! Does NOT support tables with Partition and Sort keys Yet.
    
If the item doesn't exist yet. Create the key.
Does NOT support tables with Partition and Sort keys Yet.
If the item doesn ' t exist yet . Create the key . Does NOT support tables with Partition and Sort keys Yet .
def add_key(table, key, item):
    key_names = [k for k in key]
    full_item = {**key, **item}  
    logger.debug(f'submitting item: {full_item}')  
    logger.info(f"Attempting to add new record for: {key} ")
    res = table.put_item(
        Item=full_item,
        ConditionExpression=f"attribute_not_exists({key_names[0]})",  
    )
    logger.info(f"Successfully added new record.")
    logger.debug(f"{full_item}")
    return res['ResponseMetadata']['HTTPStatusCode']
def add_key ( table , key , item ) : key_names = [ k for k in key ] full_item = { ** key , ** item } logger . debug ( f'submitting item: {full_item}' ) logger . info ( f"Attempting to add new record for: {key} " ) res = table . put_item ( Item = full_item , ConditionExpression = f"attribute_not_exists({key_names[0]})" , ) logger . info ( f"Successfully added new record." ) logger . debug ( f"{full_item}" ) return res [ 'ResponseMetadata' ] [ 'HTTPStatusCode' ]
If the item doesn't exist yet.
If the item doesn ' t exist yet .
""" If the item doesn't exist yet. Create the key.
        !! Does NOT support tables with Partition and Sort keys Yet.
    """ # noqa: E999   - only invalid in old pythons # noqa: E999   - only invalid in old pythons # TODO fix for items with Partition and Sort key
table
key
item