Created
February 9, 2012 18:01
-
-
Save mjallday/1781622 to your computer and use it in GitHub Desktop.
unique eid across marketplace
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@event.listens_for(Debit, 'before_insert') | |
def increment_balance(mapper, connection, debit): | |
eid = generate_eid('D') | |
result = 1 | |
while result: | |
result = Debit.query.filter( | |
Debit.marketplace == debit.marketplace, | |
Debit.eid == eid | |
).count() | |
debit.eid = eid |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment