In relational database design, provider_id always must refer to a row in
Provider. If that's not the case, then your database is failing
referential integrity and is mis-designed; the definition of a
ForeignKey is that it's a constraint that indicates a remote primary key
that must exist.
If you're in some situation where this isn't actually happening and you
need to work around it, it looks like you're just looking for a string
"missing" instead of None? This is just a Python access issue. Use a
method like "def get_provider_id()", or a synonym:
class LabResult(Base):
provider_id = Column(Integer)
@synonym_for("_provider_id", map_column=True)
@property
def provider_id(self):
return self._provider_id or "Missing"
>
> Thanks!
>
> --
> You received this message because you are subscribed to the Google
> Groups "sqlalchemy" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to
sqlalchemy+...@googlegroups.com
> <mailto:
sqlalchemy+...@googlegroups.com>.
> To post to this group, send email to
sqlal...@googlegroups.com
> <mailto:
sqlal...@googlegroups.com>.
> Visit this group at
https://groups.google.com/group/sqlalchemy.
> For more options, visit
https://groups.google.com/d/optout.