Skip to content
  • Kevin Morris's avatar
    aurweb.db: add query, create, delete helpers · a836892c
    Kevin Morris authored
    
    
    Takes sqlalchemy kwargs or stanzas:
    
    query(Model, Model.Column == value)
    query(Model, and_(Model.Column == value, Model.Column != "BAD!"))
    
    Updated tests to reflect the new utility and a comment about upcoming
    function deprecation is added to get_account_type().
    
    From here on, phase out the use of get_account_type().
    
    + aurweb.db: Added create utility function
    + aurweb.db: Added delete utility function
    
    The `delete` function can be used to delete a record by search
    kwargs directly.
    
    Example:
        delete(User, User.ID == 6)
    
    All three functions added in this commit are typically useful to
    perform these operations without having to import aurweb.db.session.
    Removes a bit of redundancy overall.
    
    Signed-off-by: Kevin Morris's avatarKevin Morris <kevr@0cost.org>
    a836892c