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

Any way of keeping the exsisting column names as they are? #36

Closed
avisual opened this issue Oct 4, 2022 · 8 comments
Closed

Any way of keeping the exsisting column names as they are? #36

avisual opened this issue Oct 4, 2022 · 8 comments

Comments

@avisual
Copy link

avisual commented Oct 4, 2022

When using dll with capitals in the name for dataclasses anything with capitals gets renamed such as NHS become n_h_s in the dataclass. is there any way of creating the fieldname as they are in the dll?

GBMSM smallint becomes g_b_m_s_m: int = None

@avisual
Copy link
Author

avisual commented Oct 4, 2022

Also I am seeing the column name order being re-arranged as in the order changes when output to dataclass

@xnuinside
Copy link
Owner

@avisual I can implement it as a some setting in create_models() method, something like argument 'no_auto_snake_case=True' - to remove auto formatting to snake case that I use in library

do you think it should be related only to attributes (properties) of classes or also to class names?

@avisual
Copy link
Author

avisual commented Oct 6, 2022

if you are generating from existing tables keeping the names the same as originals really helps. I know that the purest of coders would say that fails naming conventions. but then we all work in legacy systems or have no control over some data

@xnuinside
Copy link
Owner

@avisual I mean if your table called like 'products' with small case. You want as a result generate class products(): - also in the code? or capitalize it?

@xnuinside
Copy link
Owner

arg no_auto_snake_case=True was added in version 0.12.0, version already released - https://pypi.org/project/omymodels/

@avisual can you show the sample with columns re-arrange? as input sample - output sample?

@xnuinside
Copy link
Owner

I will close issue as a stale. If it will be still actual - pls open it again

@avisual
Copy link
Author

avisual commented Oct 26, 2022

Sorry had been away on holiday, will try this out today thank you for fixing :)

@faccini-bs
Copy link

We could add this option as a flag for the cli e.g. "--auto-snake" set to false by default
just wanted to put this here to remind myself

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

No branches or pull requests

3 participants