# ca_core/property.py def set_property(cursor, entity_id: int, property_name: str): cursor.execute( """ INSERT INTO property (id, property_name) VALUES (%s, %s) ON CONFLICT (id, property_name) DO NOTHING """, (entity_id, property_name) ) def delete_property(cursor, entity_id: int, property_name: str): cursor.execute( "DELETE FROM property WHERE id=%s AND property_name=%s", (entity_id, property_name) ) if cursor.rowcount == 0: raise ValueError("Property not found") def get_properties(cursor, entity_id: int): cursor.execute( "SELECT property_name FROM property WHERE id=%s", (entity_id,) ) return [row['property_name'] for row in cursor.fetchall()]