[sqlalchemy] Table Views
I am beginning to familiarize myself with basic concept in sqlalchemy. One question I am still trying to wrap my head around is creating a table view. In terms of the problem I am trying to solve, I am trying to setup schemas particularly related to financial reference data. The data doesn't change very often, but I want to setup a good schema where changing one table row changes the data in the whole system, but also create table views the most useful aspects of the data reside in one table. For example, say we have something like: security id sec_type ticker cusip sedol description exchange.id country.code country code name exchange code name country.code sec_type code description country.code currency.code *From this, I would like to create a table view with something like:* security_view id ticker cusip sedol description exchange.name sec_type.code sec_type.description sec_type.currency country.name The table view will be for viewing the whole table in applications, and mapping data between applications. I don't want a security objects in Python have attributes that are also objects in these cases, but instead act as just another data column(think pandas DataFrames). There's going to be more tables and fields that map to this view, but I am trying to understand the best way in sqlAlchemy to create these types of views? -- You received this message because you are subscribed to the Google Groups sqlalchemy group. To unsubscribe from this group and stop receiving emails from it, send an email to sqlalchemy+unsubscr...@googlegroups.com. To post to this group, send email to sqlalchemy@googlegroups.com. Visit this group at http://groups.google.com/group/sqlalchemy. For more options, visit https://groups.google.com/d/optout.
Re: [sqlalchemy] Process UNION results
order_by(text(“union_date”)) does a trick - thank you! Cheers, TSz Michael Bayer wrote: I’d probably try to order_by(text(“union_date”)) so that it isn’t interpreted as a column object. If that doesn’t work, then the query here should use a simple Core union object, and then a new query session.query(my_union.c.union_date).distinct().order_by(my_union.c.union_date). pide...@gmail.com javascript: wrote: Hi, I am trying to process UNION results - there is a code, but I think it is better to ready it properly formatted, thus I am attaching url to stack: http://stackoverflow.com/questions/29208591/sqlalchemy-process-union-result I would be grateful if you could give me any hints how to deal with it. Thanks and cheers, TSz -- You received this message because you are subscribed to the Google Groups sqlalchemy group. To unsubscribe from this group and stop receiving emails from it, send an email to sqlalchemy+...@googlegroups.com javascript:. To post to this group, send email to sqlal...@googlegroups.com javascript:. Visit this group at http://groups.google.com/group/sqlalchemy. For more options, visit https://groups.google.com/d/optout. -- You received this message because you are subscribed to the Google Groups sqlalchemy group. To unsubscribe from this group and stop receiving emails from it, send an email to sqlalchemy+unsubscr...@googlegroups.com. To post to this group, send email to sqlalchemy@googlegroups.com. Visit this group at http://groups.google.com/group/sqlalchemy. For more options, visit https://groups.google.com/d/optout.
Re: [sqlalchemy] Table Views
you can use a select as a mapped object if you want, but i don't know if that's what you're looking for. On 03/26/2015 01:54 PM, Philip Martin wrote: am trying to setup schemas particularly related to financial reference data. The data doesn't change very often, but I want to setup a good schema where changing one table row changes the data in the whole system, but also create table views the most useful aspects of the data reside in one table. For example, say we have something like: -- You received this message because you are subscribed to the Google Groups sqlalchemy group. To unsubscribe from this group and stop receiving emails from it, send an email to sqlalchemy+unsubscr...@googlegroups.com. To post to this group, send email to sqlalchemy@googlegroups.com. Visit this group at http://groups.google.com/group/sqlalchemy. For more options, visit https://groups.google.com/d/optout.
Re: [sqlalchemy] Process UNION results
I’d probably try to order_by(text(“union_date”)) so that it isn’t interpreted as a column object. If that doesn’t work, then the query here should use a simple Core union object, and then a new query session.query(my_union.c.union_date).distinct().order_by(my_union.c.union_date). pidev...@gmail.com wrote: Hi, I am trying to process UNION results - there is a code, but I think it is better to ready it properly formatted, thus I am attaching url to stack: http://stackoverflow.com/questions/29208591/sqlalchemy-process-union-result I would be grateful if you could give me any hints how to deal with it. Thanks and cheers, TSz -- You received this message because you are subscribed to the Google Groups sqlalchemy group. To unsubscribe from this group and stop receiving emails from it, send an email to sqlalchemy+unsubscr...@googlegroups.com. To post to this group, send email to sqlalchemy@googlegroups.com. Visit this group at http://groups.google.com/group/sqlalchemy. For more options, visit https://groups.google.com/d/optout. -- You received this message because you are subscribed to the Google Groups sqlalchemy group. To unsubscribe from this group and stop receiving emails from it, send an email to sqlalchemy+unsubscr...@googlegroups.com. To post to this group, send email to sqlalchemy@googlegroups.com. Visit this group at http://groups.google.com/group/sqlalchemy. For more options, visit https://groups.google.com/d/optout.
[sqlalchemy] Process UNION results
Hi, I am trying to process UNION results - there is a code, but I think it is better to ready it properly formatted, thus I am attaching url to stack: http://stackoverflow.com/questions/29208591/sqlalchemy-process-union-result I would be grateful if you could give me any hints how to deal with it. Thanks and cheers, TSz -- You received this message because you are subscribed to the Google Groups sqlalchemy group. To unsubscribe from this group and stop receiving emails from it, send an email to sqlalchemy+unsubscr...@googlegroups.com. To post to this group, send email to sqlalchemy@googlegroups.com. Visit this group at http://groups.google.com/group/sqlalchemy. For more options, visit https://groups.google.com/d/optout.