def from_taxdb(cls, con, root=None):
        """
        Generate a TaxNode from a taxonomy database
        """
        cursor = con.cursor()
        if root is None:
            cursor.execute(
                "SELECT tax_id, rank FROM nodes WHERE tax_id = parent_id")
        else:
            cursor.execute(
                "SELECT tax_id, rank FROM nodes WHERE tax_id = ?", [root])

        tax_id, rank = cursor.fetchone()
        root = cls(rank=rank, tax_id=tax_id)

        def add_lineage(parent):
            cursor.execute("""SELECT tax_id, rank, tax_name
                    FROM nodes INNER JOIN names USING (tax_id)
                    WHERE parent_id = :1 and tax_id <> :1
                        AND names.is_primary = 1
                    """, [parent.tax_id])
            for tax_id, rank, name in cursor:
                node = cls(rank=rank, tax_id=tax_id, name=name)
                parent.add_child(node)
            for child in parent.children:
                add_lineage(child)

        add_lineage(root)
        return root