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

feature: set custom table name for insertion #1375

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

c9s
Copy link
Contributor

@c9s c9s commented Apr 5, 2024

No description provided.

@c9s c9s force-pushed the c9s/set-custom-table-name branch from c9e4485 to 4064e81 Compare April 5, 2024 10:24
@c9s
Copy link
Contributor Author

c9s commented Apr 6, 2024

@stephenafamo please take a look,, thanks!

@c9s c9s force-pushed the c9s/set-custom-table-name branch from 4064e81 to 07b90f1 Compare April 8, 2024 05:28
@stephenafamo
Copy link
Collaborator

What is the use case for this?

@c9s
Copy link
Contributor Author

c9s commented May 14, 2024

What is the use case for this?

for database sharding, for large datasets we need to move these data in different tables with the same schema

@c9s
Copy link
Contributor Author

c9s commented May 14, 2024

this is the related ticket (discussion)
#1378

@@ -71,6 +74,8 @@ var {{$alias.UpSingular}}TableColumns = struct {
{{end -}}
}

const {{$alias.UpSingular}}TableName = "{{.Table.Name}}"
Copy link
Collaborator

Choose a reason for hiding this comment

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

This is unnecessary, there is a struct with table names in the singleton. Let's reuse that.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

this is fixed

Copy link
Collaborator

@stephenafamo stephenafamo left a comment

Choose a reason for hiding this comment

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

Still not sure about this use case for most users, but I have a few proposed changes to the PR.

@stephenafamo
Copy link
Collaborator

for database sharding, for large datasets we need to move these data in different tables with the same schema

Instead of making this change to SQLBoiler, did you consider having extra templates to add an extra method to the models?
https://github.com/volatiletech/sqlboiler?tab=readme-ov-file#templates

@c9s
Copy link
Contributor Author

c9s commented May 25, 2024

for database sharding, for large datasets we need to move these data in different tables with the same schema

Instead of making this change to SQLBoiler, did you consider having extra templates to add an extra method to the models? https://github.com/volatiletech/sqlboiler?tab=readme-ov-file#templates

Hi @stephenafamo

Thank you for the suggestion. I have considered the template approach, but it seems overly complex for this particular need. Given SQLBoiler's status as a modern ORM tool, I believe incorporating native support for database sharding would significantly enhance its utility for projects requiring robust scalability. This feature would not only simplify development but also align SQLBoiler with the evolving demands of large-scale applications.

If SQLBoiler is unable to support this functionality, I may need to explore other solutions that offer built-in sharding capabilities to meet the scalability requirements of my project. I hope we can keep SQLBoiler as our primary ORM tool and avoid the need to switch.

@c9s c9s force-pushed the c9s/set-custom-table-name branch from 07b90f1 to 885eae9 Compare May 25, 2024 12:21
@c9s
Copy link
Contributor Author

c9s commented May 25, 2024

Or maybe you prefer other API design? maybe we can discuss?

@c9s c9s requested a review from stephenafamo May 26, 2024 02:58
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

2 participants