8.2.10.4.3.24. Txn

class Txn(**kwargs)[source]

Methods

__delattr__

Implement delattr(self, name).

__dir__

Default dir() implementation.

__eq__

Return self==value.

__format__

Default object formatter.

__ge__

Return self>=value.

__getattribute__

Return getattr(self, name).

__getstate__

Helper for pickle.

__gt__

Return self>value.

__hash__

Return hash(self).

__init__

A simple constructor that allows initialization from kwargs.

__init_subclass__

This method is called when a class is subclassed.

__le__

Return self<=value.

__lt__

Return self<value.

__ne__

Return self!=value.

__new__

__reduce__

Helper for pickle.

__reduce_ex__

Helper for pickle.

__repr__

Return repr(self).

__setattr__

Implement setattr(self, name, value).

__sizeof__

Size of object in memory, in bytes.

__str__

Return str(self).

__subclasshook__

Abstract classes can override this to customize issubclass().

update_credits

__init__(**kwargs)

A simple constructor that allows initialization from kwargs.

Sets attributes on the constructed instance using the names and values in kwargs.

Only keys that are present as attributes of the instance’s class are allowed. These could be, for example, any mapped columns or relationships.

Attributes

__abstract__

__annotations__

__dict__

__doc__

__fsa__

Internal reference to the extension object.

__mapper__

__module__

__table__

__tablename__

__weakref__

list of weak references to the object

_sa_class_manager

_sa_registry

created_at

created_by

credits

currency

discount

expired_at

id

metadata

product

raw_data

registry

stripe_id

subtotal

tax

total

type

type_id

updated_at

updated_by

valid_from

wallet

wallet_id

__tablename__ = 'wallet_transaction'
id
wallet_id
wallet
type_id
type
credits
product
discount
subtotal
tax
total
currency
stripe_id
raw_data
expired_at
valid_from
created_at
updated_at
created_by
updated_by
__repr__()[source]

Return repr(self).

update_credits(credits, session=<sqlalchemy.orm.scoping.scoped_session object>, force=False)[source]
__annotations__ = {'__fsa__': 't.ClassVar[SQLAlchemy]', 'query': 't.ClassVar[Query]', 'query_class': 't.ClassVar[type[Query]]'}
__doc__ = None
__init__(**kwargs)

A simple constructor that allows initialization from kwargs.

Sets attributes on the constructed instance using the names and values in kwargs.

Only keys that are present as attributes of the instance’s class are allowed. These could be, for example, any mapped columns or relationships.

__mapper__ = <Mapper at 0x78ac452050d0; Txn>
__module__ = 'schedula.utils.form.server.credits'
__table__ = Table('wallet_transaction', MetaData(), Column('id', Integer(), table=<wallet_transaction>, primary_key=True, nullable=False), Column('wallet_id', Integer(), ForeignKey('wallet.id'), table=<wallet_transaction>, nullable=False), Column('type_id', Integer(), ForeignKey('transaction_type.id'), table=<wallet_transaction>, nullable=False), Column('credits', Integer(), table=<wallet_transaction>, default=ScalarElementColumnDefault(0)), Column('product', String(length=255), table=<wallet_transaction>), Column('discount', Integer(), table=<wallet_transaction>, default=ScalarElementColumnDefault(0)), Column('subtotal', Integer(), table=<wallet_transaction>, default=ScalarElementColumnDefault(0)), Column('tax', Integer(), table=<wallet_transaction>, default=ScalarElementColumnDefault(0)), Column('total', Integer(), table=<wallet_transaction>, default=ScalarElementColumnDefault(0)), Column('currency', String(length=64), table=<wallet_transaction>), Column('stripe_id', String(length=255), table=<wallet_transaction>), Column('raw_data', JSON(), table=<wallet_transaction>), Column('expired_at', DateTime(), table=<wallet_transaction>), Column('valid_from', DateTime(), table=<wallet_transaction>, nullable=False, default=CallableColumnDefault(<function datetime.utcnow>)), Column('created_at', DateTime(), table=<wallet_transaction>, nullable=False, default=CallableColumnDefault(<function datetime.utcnow>)), Column('updated_at', DateTime(), table=<wallet_transaction>, onupdate=CallableColumnDefault(<function datetime.utcnow>)), Column('created_by', Integer(), ForeignKey('user.id'), table=<wallet_transaction>, default=CallableColumnDefault(<function Txn.<lambda>>)), Column('updated_by', Integer(), ForeignKey('user.id'), table=<wallet_transaction>, onupdate=CallableColumnDefault(<function Txn.<lambda>>)), schema=None)
_sa_class_manager = {'created_at': <sqlalchemy.orm.attributes.InstrumentedAttribute object>, 'created_by': <sqlalchemy.orm.attributes.InstrumentedAttribute object>, 'credits': <sqlalchemy.orm.attributes.InstrumentedAttribute object>, 'currency': <sqlalchemy.orm.attributes.InstrumentedAttribute object>, 'discount': <sqlalchemy.orm.attributes.InstrumentedAttribute object>, 'expired_at': <sqlalchemy.orm.attributes.InstrumentedAttribute object>, 'id': <sqlalchemy.orm.attributes.InstrumentedAttribute object>, 'product': <sqlalchemy.orm.attributes.InstrumentedAttribute object>, 'raw_data': <sqlalchemy.orm.attributes.InstrumentedAttribute object>, 'stripe_id': <sqlalchemy.orm.attributes.InstrumentedAttribute object>, 'subtotal': <sqlalchemy.orm.attributes.InstrumentedAttribute object>, 'tax': <sqlalchemy.orm.attributes.InstrumentedAttribute object>, 'total': <sqlalchemy.orm.attributes.InstrumentedAttribute object>, 'type': <sqlalchemy.orm.attributes.InstrumentedAttribute object>, 'type_id': <sqlalchemy.orm.attributes.InstrumentedAttribute object>, 'updated_at': <sqlalchemy.orm.attributes.InstrumentedAttribute object>, 'updated_by': <sqlalchemy.orm.attributes.InstrumentedAttribute object>, 'valid_from': <sqlalchemy.orm.attributes.InstrumentedAttribute object>, 'wallet': <sqlalchemy.orm.attributes.InstrumentedAttribute object>, 'wallet_id': <sqlalchemy.orm.attributes.InstrumentedAttribute object>}
query: t.ClassVar[Query]

A SQLAlchemy query for a model. Equivalent to db.session.query(Model). Can be customized per-model by overriding query_class.

Warning

The query interface is considered legacy in SQLAlchemy. Prefer using session.execute(select()) instead.