Query all entities of a specific type, with their attributes

        Args:
            type_to_query (str): type of entity to query
            client: DB client to perform query with

        Returns:
            pandas.DataFrame: table of entities, with attributes as columns

def query_with_attributes(type_to_query, client):
        """Query all entities of a specific type, with their attributes

        Args:
            type_to_query (str): type of entity to query
            client: DB client to perform query with

        Returns:
            pandas.DataFrame: table of entities, with attributes as columns
        """
        session = client.create_session()

        # query all data
        query = session.query(Attribute.name,
                              Attribute.value,
                              Entity.id) \
            .join(Entity) \
            .filter(Entity.type == type_to_query)

        df = client.df_query(query)

        session.close()

        # don't store NaN values
        df = df.dropna(how='any')

        # pivot attribute names to columns, drop column names to one level
        # ('unstack' generated multi-level names)
        df = df.set_index(['id', 'name']).unstack().reset_index()
        # noinspection PyUnresolvedReferences
        df.columns = ['id'] + list(df.columns.get_level_values(1)[1:])

        return df