Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added a variable mintLimit #111

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

sebastiangaertner
Copy link
Contributor

Since i have not run this as a dag yet this is the first attempt at this.

Since i have not run this as a dag yet this is the first attempt at this.
create-tokens.py Outdated
@@ -108,15 +113,15 @@ def create_tokens(ds, **kwargs):
AND active = true
AND approved = true
AND token_id IS NULL
LIMIT 3000
LIMIT .format(mintLimit)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not sure about this one though... syntax might be wrong

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need to test it fully, I remember this syntax for variables:
f""" some {variable}"""

@CareyAltgilbers can you also help on this?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@asarephilip there it is

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dadiorchen Yes, I'll be happy to take a look at it.

Copy link
Collaborator

@CareyAltgilbers CareyAltgilbers Oct 25, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hello,

It looks like on line 61 kwards is a typo and should be kwargs.

In the SQL statement on line 116 we should be able to change LIMIT .format(mintLimit) to Limit {} and then on line 117 change that to """.format(entityId, mintLimit))

That gives us two unnamed variables in this SQL statement, one on line 110 in a function call and another in line 116.

I ran the code in a test script and did not get any syntax errors, if you have some test data I can use for the entityId and mintLimit I would run the test script again.

cursor.execute("""
select id, uuid, token_id from trees
where
planter_id IN (
select id from planter
where
organization_id IN (
select entity_id from getEntityRelationshipChildren({})
)
)
AND active = true
AND approved = true
AND token_id IS NULL
LIMIT {}
""".format(entityId, mintLimit))

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

changed it. Should be fine now. see new change request

@@ -72,7 +74,10 @@ def create_tokens(ds, **kwargs):
if dryRun is None:
print('dryRun is None')
return

if mintLimit is None:

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know the busines logic behind this but I will recommend setting a default minLimit rather than exiting the job when minLimit is None.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

business logic works better with a limit every time. that is fine

Copy link
Contributor Author

@sebastiangaertner sebastiangaertner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@CareyAltgilbers this should be ok now or?

Copy link
Collaborator

@CareyAltgilbers CareyAltgilbers left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Those updates look good.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants