[PonyORM-list] Table names
Vincent LE GOFF
vincent.legoff.srs at gmail.com
Thu Jun 18 18:18:16 UTC 2015
Hello Alexey,
Thank you for your reply. Yes, it would help, if it worked for packages
too (I usually recommend using a single class per module, or per file,
anyway). If this prefix can be defined in the package '__init__.py'
file or something like that, it would definitely help a lot. And make
names much more pleasant even for those who have to work with the DB
itself, since my idea (of having the full path of each class as a name)
would make names like 'path_subpath_modulename_pluralclassname' which
isn't very beautiful, your solution seems better.
Thanks again,
Vincent
Le 6/18/2015 9:59 AM, Alexey Malashkevich a écrit :
> Hi Vincent,
>
> We thought about your request a little bit and here what we can suggest.
> We could introduce an ability to declare the variable in a module such as
>
> PONY_TABLE_PREFIX = "some_prefix_"
>
> When Pony processes entity definitions, it checks if this variable is
> declared in the current module. If it is, then Pony adds this prefix
> to all table names. What do you think about this idea? Would it cover
> your needs?
>
> Regards,
> Alexey
>
> On Mon, Jun 15, 2015 at 9:27 PM, Vincent LE GOFF
> <vincent.legoff.srs at gmail.com <mailto:vincent.legoff.srs at gmail.com>>
> wrote:
>
> Hi everyone,
>
> I was wondering something very simple: In an application with a
> lot of classes that should be saved in the database, name conflict
> isn't that scarce. In fact, since I'm trying to design a modular
> project, everyone could add new classes. Pony might not like that
> a bit if two classes have similar names.
>
> An obvious solution is to use the full names of classes
> (package.subpackage.subsubpackage....ClassName) instead. We could
> use underscores instead of dots, dots are not a good idea in table
> names I guess. I might be able to create a metaclass of some sort
> to do just that. But perhaps there's an easier way to do it.
> Besides, I don't know if it would react well.
>
> Thanks for your help and your work,
>
> Vincent
> _______________________________________________
> ponyorm-list mailing list
> ponyorm-list at ponyorm.com <mailto:ponyorm-list at ponyorm.com>
> /ponyorm-list
>
>
>
>
> _______________________________________________
> ponyorm-list mailing list
> ponyorm-list at ponyorm.com
> /ponyorm-list
-------------- next part --------------
An HTML attachment was scrubbed...
URL: </ponyorm-list/attachments/20150618/390524e7/attachment.html>
More information about the ponyorm-list
mailing list