微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

SQLAlchemy 查询后访问@property

如何解决SQLAlchemy 查询后访问@property

如果我在 sqlAlchemy 中有两个模型:

    $products = wc_get_product( $product_id );
    
    $nonwh = $product->get_attribute('nonwh'); 
    
        if( ! empty( $nonwh ) ){
            
// Do nothing if product has the nonwh attribute

        } else {
        //Show Products
    }

我执行了一个连接查询,例如

class Person(): 
  person_id = db.Column(db.Integer)

class Student()
  student_id = db.column(db.Integer)

  @property
  def returnExample(self): 
    return 'Example string'

如何访问 Student 的属性装饰器?

results = Person.query.join(Student).all()

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。