Skip to content

Commit

Permalink
Check type of constraint using isinstance() rather than by type field
Browse files Browse the repository at this point in the history
  • Loading branch information
JeremyMcCormick committed Aug 29, 2024
1 parent 7522f0e commit 4dc8873
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions python/felis/tap.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@

from felis import datamodel

from .datamodel import Constraint, Index, Schema, Table
from .datamodel import Constraint, ForeignKeyConstraint, Index, Schema, Table
from .types import FelisType

__all__ = ["TapLoadingVisitor", "init_tables"]
Expand Down Expand Up @@ -480,10 +480,9 @@ def visit_constraint(self, constraint_obj: Constraint) -> tuple:
A tuple of the SQLAlchemy ORM objects for the TAP_SCHEMA ``key``
and ``key_columns`` data.
"""
constraint_type = constraint_obj.type
key = None
key_columns = []
if constraint_type == "ForeignKey":
if isinstance(constraint_obj, ForeignKeyConstraint):
constraint_name = constraint_obj.name
description = constraint_obj.description
utype = constraint_obj.votable_utype
Expand Down

0 comments on commit 4dc8873

Please sign in to comment.