<div dir="ltr">I think in this case A and B should be different tables by default</div><div class="gmail_extra"><br><br><div class="gmail_quote">2014-07-08 13:58 GMT+07:00 Alexander Kozlovsky <span dir="ltr"><<a href="mailto:alexander.kozlovsky@gmail.com" target="_blank">alexander.kozlovsky@gmail.com</a>></span>:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Hi Matthew!<div><br></div><div>As a workaround, you can explicitly specify unique column name for each conflicted attribute:<br>
<br><div>class A(Base):</div><div><span style="white-space:pre-wrap"> </span>x = Optional(int)</div>
<div><span style="white-space:pre-wrap"> </span>y = Optional(int, column="A_y")</div><div><br></div><div>class B(Base):</div><div><span style="white-space:pre-wrap"> </span>y = Optional(int, column="B_y")</div>
<div><span style="white-space:pre-wrap"> </span>z = Optional(int)</div><br><br>In future we probably should silently use the same column for two or more sibling classes if column definition is exactly the same in each class.<br>
<br><br></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Tue, Jul 8, 2014 at 2:48 AM, Matthew Bell <span dir="ltr"><<a href="mailto:matthewrobertbell@gmail.com" target="_blank">matthewrobertbell@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><div><div><div>Hi,<br><br></div>I have a project where it is intuitive to model the data by creating a bunch of models which all inherit from a base model, and share a lot of the same attributes (they'd be storing results of very similar processes).<br>
<br>Here is how I tried to attempt it:<br><br><a href="https://gist.github.com/anonymous/26a8ff2bbfe38bea32ef" target="_blank">https://gist.github.com/anonymous/26a8ff2bbfe38bea32ef</a><br><br></div>This fails, because "DBSchemaError: Column 'y' already exists in table 'Base'".<br>
<br></div>I can do it like this:<br><br><a href="https://gist.github.com/anonymous/e70f7aebacea9e97ff90" target="_blank">https://gist.github.com/anonymous/e70f7aebacea9e97ff90</a><br><br></div>It works, but quickly becomes messy when I have many attributes (up to around 30 would be needed), as there would be many useless classes, and inheriting from say 10 classes at once does not seem clear to me, compared to just defining repeated attributes. Is there a way I can make the former example work, or am I missing an alternative technique to get the same result? It seems advantageous to inherit from a base, so that it is easy to search all data by issuing queries on only one table.<br>
<br>Thanks<span class="HOEnZb"><font color="#888888"><span><font color="#888888"><br clear="all"><div><div><div><div><div><br>-- <br>Regards,<br><br>Matthew Bell<br>
</div></div></div></div></div></font></span></font></span></div><span class="HOEnZb"><font color="#888888">
<br>_______________________________________________<br>
ponyorm-list mailing list<br>
<a href="mailto:ponyorm-list@ponyorm.org" target="_blank">ponyorm-list@ponyorm.org</a><br>
<a href="/ponyorm-list" target="_blank">/ponyorm-list</a><br>
<br></font></span></blockquote></div><br></div></div>
<br>_______________________________________________<br>
ponyorm-list mailing list<br>
<a href="mailto:ponyorm-list@ponyorm.org">ponyorm-list@ponyorm.org</a><br>
<a href="/ponyorm-list" target="_blank">/ponyorm-list</a><br>
<br></blockquote></div><br></div>