i_vis/core/db_utils.py
def row_count(tname: str) -> int:
    """Get row count for table.

    Args:
        tname: The table name to retrieve row count.

    Returns:
        The number of rows for a table.
    """

    table = get_table(tname)
    # TODO TEST primary_key = model.__mapper__.primary_key[0].name
    pks = tuple(pk for pk in table.__table__.primary_key.columns)
    return int(db.session.query(func.count(*pks)).scalar())
    # apparently slower: return model.query.count()
Get row count for table.

    Args:
        tname: The table name to retrieve row count.

    Returns:
        The number of rows for a table.
    
Get row count for table.
Get row count for table .
def row_count(tname: str) -> int:
    table = get_table(tname)
    pks = tuple(pk for pk in table.__table__.primary_key.columns)
    return int(db.session.query(func.count(*pks)).scalar())
def row_count ( tname : str ) -> int : table = get_table ( tname ) pks = tuple ( pk for pk in table . __table__ . primary_key . columns ) return int ( db . session . query ( func . count ( * pks ) ) . scalar ( ) )
Get row count for table.
Get row count for table .
"""Get row count for table.

    Args:
        tname: The table name to retrieve row count.

    Returns:
        The number of rows for a table.
    """ # TODO TEST primary_key = model.__mapper__.primary_key[0].name # apparently slower: return model.query.count()
The number of rows for a table.
The number of rows for a table .
tname
str
The table name to retrieve row count.
The table name to retrieve row count .