Receiving a policy with check option violation error when inserting into table

26 Views Asked by At

I am using sqlalchemy in my python application. I am trying to insert into an Oracle database table that has a policy over it. My insert fails with ORA-28115: policy with check option violation.

I first query the table to see if there is an existing entry. pointsite = self.db_session.query(Site).filter_by(feature_parent_site_id=int(fac_site_id), site_fed_id=site_fed_id,site_name=unit_desc, site_type_id=514).one_or_none()

Then if pointsite is None, I am trying to insert a record.

    if pointsite is None:
        #create the new point
        point_record = Site(
            feature_parent_site_id=fac_site_id,
            site_fed_id=site_fed_id,
            site_name=unit_desc,
            site_type_id=514,
        )
        self.db_session.add(point_record)
        self.db_session.commit()

When it tries to perform the commit, I receive the policy with check option violation.

0

There are 0 best solutions below