The target function looks like this:

class Rule:
"""Invoke these functions to declare rules.

Rules are *not* run as they are defined,
they are run when you issue `session.commit()'.

.. _Rule Summary:
https://github.com/valhuber/LogicBank/wiki/Rule-Summary

Use code completion to discover rules and their parameters.
"""

@staticmethod
def sum(derive: InstrumentedAttribute, as_sum_of: any, where: any = None, 
child_role_name: str = ""):
"""
Derive parent column as sum of designated child column, optional where

Example
Rule.sum(derive=models.Customer.Balance, as_sum_of=models.Order.AmountTotal,
where=Lambda row: row.ShippedDate is None)

Optimized to eliminate / minimize SQLs: Pruning, Adjustment Logic

Args:
derive: name of parent <class.attribute> being derived
as_sum_of: name of child <class.attribute> being summed
child_role_name: parent's child accessor attribute (required only for 
disambiguation)
where: optional where clause, designates which child rows are summed


"""
return Sum(derive, as_sum_of, where, child_role_name)




The model is declared like this:

class Customer(SAFRSBase, Base):
__tablename__ = 'Customer'
_s_collection_name = 'Customer'
__bind_key__ = 'None'

Id = Column(String(8000), primary_key=True)
CompanyName = Column(String(8000))
Balance = Column(DECIMAL)
On Thursday, February 23, 2023 at 4:36:11 PM UTC-8 Val Huber wrote:

> Hello, All
>
> In SQLAlchemy 1.4.29, the I get the warnings shown in the attached screen 
> shot.  These are calls to LogicBank; if I alter LogicBank to use Column 
> instead of InstrumentedAttribute, it fails with 
>
> AttributeError: Neither 'InstrumentedAttribute' object nor 'Comparator' 
> object associated with Customer.Balance has an attribute 'descriptor'
>
> I don't believe I got these warnings with SQLAlchemy 1.3.
>
> Suggestions?
>
> Thanks,
> Val
>
>
>

-- 
SQLAlchemy - 
The Python SQL Toolkit and Object Relational Mapper

http://www.sqlalchemy.org/

To post example code, please provide an MCVE: Minimal, Complete, and Verifiable 
Example.  See  http://stackoverflow.com/help/mcve for a full description.
--- 
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sqlalchemy/34ea2b6f-6921-4245-985a-d4f2a258d7e0n%40googlegroups.com.

Reply via email to