maxtepkeev / architect

A set of tools which enhances ORMs written in Python with more features
Other
391 stars 57 forks source link

Support table names with hyphens #52

Closed emord closed 4 years ago

emord commented 6 years ago

Currently only tested for postgres and SQLAlchemy. I'm not familiar with the MySQL syntax for this type of fix. Also it's a hard to hit this in django (unless you specify custom table names). Not sure about the other ORMs.

Similar fix as https://github.com/maxtepkeev/architect/commit/e6fc9cd9923a7c5d68b53fe9abc943fe29f45b3f

Happy to change some of this up. Replacing the - with _ for the function name feels particularly hacky, but wasn't sure of a better convention to follow

emord commented 6 years ago

Hi @maxtepkeev

After further testing I realized that a similar issue happens when you have very long table names. To fix these in the same way I changed child tables and functions to use the md5 of tables for these identifiers.

Let me know if you have a better standard for handling this. Happy to make a change

maxtepkeev commented 6 years ago

Hi @emord

That's cool, thx. I need to think about this more carefully though before merging. Also it would be great if you can do tests for other ORM's we support (should be easy even if you're not using them, just see the examples of current tests, copy'n'paste, do the needed modifications and run on travis to see if they work).

Will get back to you with the review as soon as I have some time. Thanks!