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

Refactor(torii-core): Optimize and clean sql statements #927

Merged
merged 5 commits into from
Oct 25, 2023

Conversation

gianalarcon
Copy link
Contributor

@gianalarcon gianalarcon commented Sep 26, 2023

Refactor fn register_model(), and fn set_entity() to get rid of extra SQL query statements.

Solution
Use RETURNING clause to avoid unnecessary SQL statements

@broody
Copy link
Collaborator

broody commented Sep 26, 2023

Thanks! there are some sizable changes coming down the pipe (#916), I think we could wait for this one to land first. Also we're gonna be moving to block_id instead of created_at at some point.

@tarrencev tarrencev closed this Sep 27, 2023
@tarrencev tarrencev reopened this Sep 27, 2023
@tarrencev tarrencev closed this Oct 3, 2023
@gianalarcon gianalarcon deleted the query_optimization branch October 19, 2023 10:23
@gianalarcon gianalarcon restored the query_optimization branch October 19, 2023 10:23
@broody
Copy link
Collaborator

broody commented Oct 22, 2023

Reopening for @gianalarcon now that nested model is implemented

@broody broody reopened this Oct 22, 2023
@gianalarcon gianalarcon marked this pull request as draft October 23, 2023 04:03
@gianalarcon gianalarcon marked this pull request as ready for review October 23, 2023 04:58
@gianalarcon
Copy link
Contributor Author

Ready for review!

@gianalarcon gianalarcon marked this pull request as draft October 24, 2023 04:14
@gianalarcon gianalarcon marked this pull request as ready for review October 24, 2023 04:15
Copy link
Contributor

@tarrencev tarrencev left a comment

Choose a reason for hiding this comment

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

minor suggestion otherwise lgtm!

));
);
// execute first to get created_at
let query_result: SqliteRow = sqlx::query(&insert_entities).fetch_one(&self.pool).await?;
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you use query_as here?

Copy link
Contributor

Choose a reason for hiding this comment

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

Merging. Feel free to follow up with the change

@tarrencev tarrencev merged commit a8b7903 into dojoengine:main Oct 25, 2023
@gianalarcon gianalarcon mentioned this pull request Oct 26, 2023
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.

3 participants