-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Column names in lowercase using lb4 discover method - SQL connector #3343
Comments
@bajtos , @emonddr , @raymondfeng, @ritch , Can anyone, any update on this. Help me |
@agnes512, could you please take a look? Thanks. |
I reproduced the above issue by using
I can access database with the generated models. I figured that this issue is more about developer-experience instead of a bug. And the lowerCamelCase name might be generated here, not sure about it. As for the naming convention feature, it needs further discussion. |
@sureshkodur Hi! I was testing it out yesterday. And it does generate |
@agnes512 , In my MSSQL db, it has the column name as 'ErrorID', which is in Uppper CamelCase. But when I'm trying to generate schema using lb4 discover it is errorid instead of ErrorID. But I need it as ErrorID in model. Are you understand the issue? |
Yes. After getting models from MySQL, do you still use MySQL as your database? In my case, I did, and the app works fine, by that I mean, my application can store/get data via MySQL even it is using That's why I figured the naming convention does not cause functional errors. It's about how we convert column names to property names. This issue is more about dev experience. That's why I changed the label, which helps us to plan things out. 😄 If you're getting any functional errors (such as API doesn't work, controller generating error) because of the naming, please let me know, and how I can reproduce it. |
@sureshkodur Hi, I also tried it out on MSSQL. I got the same result: reproduced that issue, and the App still works. i.e I can use {
"name": "db",
"connector": "mssql",
"host": "localhost",
"port": 1433,
"user": ...,
"password": ... ,
"database": "master"
} Like I mentioned above, I believe this ( Sorry that we don't have naming convention options available for now. You can still change Thanks |
@agnes512 , Yes. App working fine for me also. There is no issue. Only issue with the naming convention. For now, I'm done it manulally. Thank you. |
@agnes512 , could you please add the acceptance criteria so that the team can estimate? Thanks. |
@strongloop/loopback-maintainers We've been having this issue for a while. To improve the developer experience, what kind of acceptance criteria do we want to achieve? I mentioned the naming convention here is because from issue Provide a way to specify table and field naming convention with automigrate/autoupdate, it seems like different conventions are needed for different DBs. We know that db column name and the corresponding model property name can be different. Maybe this will allow us to have different naming conventions. Any thoughts? |
I'm thinking whether it's possible to allow users to plug-in their own naming convention (similar to what's mentioned in loopbackio/loopback-connector-mysql#57 (comment)). This is because users have different naming conventions, it's not likely that we pick one naming convention and satisfy everyone. |
For this particular use case:
I think we should at least allow people to either honor the column name from db ( Some thought about supporting custom naming convension:
|
I am not sure about |
My two cents: By default, I would like our model discovery to recognize all common naming styles (
While we can add an extension point allowing users to provide custom function to transform database column names to LB4 property names, I consider that as out of scope. I also think we should focus on model discovery only, I am proposing to leave naming conventions used during database migrations out of scope of this discussion. |
@bajtos I agree that the default property name should be camelCase instead of lowercase and focus on I also agree with @jannyHou that we should also allow people to have their property name the same as db column names as part of scope in the story. e.g: How about: Criteria:
Out of scope:
|
LGTM 👏 Personally, I am also ok to leave the task "keep it the same as the column names ( might cause unexpected behavior. please read the ....file)" out of scope, depending on what other team members prefer. |
Make sure the name passes the validation function and also converts the expected case. |
closing as done! |
Describe
Hi Team. I'm generating models from SQL db using
lb4 discover
method. But, the column names generating in lowercase. While in my SQL db, they are in camelCase. See, below code:Current behavior
The column name is generated in lowercase as
errorid
instead ofErrorID
.Expected Behavior
ErrorID
as it is.Acceptance Criteria
lb4 discover
camelCase ( LB4 default, recommended)
keep it the same as the column names ( warning: might cause unexpected behavior. please read the ....file)
Out of scope:
The text was updated successfully, but these errors were encountered: