[sqlalchemy] Advice for Method to consistently import XML into SQLAlchemy

2014-05-15 Thread Sayth Renshaw
I can manipulate the xml now with xmltodict and lxml.objectify but I am not sure about what I am transforming it to, the what will SqlAlchemy require of me. -- You received this message because you are subscribed to the Google Groups sqlalchemy group. To unsubscribe from this group and stop

Re: [sqlalchemy] Advice for Method to consistently import XML into SQLAlchemy

2014-05-15 Thread AM
On 05/14/2014 04:23 AM, Sayth Renshaw wrote: Hi Looking for some guidance and advice on using xml as an update source for my to be data web project. If I am consistently going to be updating data into the database from XML files what is a good method? Should I be creating a Sax parser as

Re: [sqlalchemy] How do you limit/specify the columns that are loaded via a relationship()?

2014-05-15 Thread Jonathan Vanasco
Michael- Quick question for clarity... I have a table with a few deferred columns. If I want to eagerly load them during a query, I should pass in the undefer option right ? -- You received this message because you are subscribed to the Google Groups sqlalchemy group. To unsubscribe from

Re: [sqlalchemy] How do you limit/specify the columns that are loaded via a relationship()?

2014-05-15 Thread Michael Bayer
yeah there's some bad history with the API here, in that you can't easily pass them all at once, but right now it's q.options(undefer('*')) for everything or q.options(undefer('x'), undefer('y'), ...). or undefer_group() if you've applied a group to them. On May 15, 2014, at 1:42 PM,

[sqlalchemy] bindparams fails for the table

2014-05-15 Thread google
Hi, my program tries to read data from a configurable, unknown user table. So I came up with such a statement: result = self.session.execute(SELECT * FROM :mytable, {mytable: self.table}) But when I run it, I get this, what I do not understand: result = self.session.execute(SELECT

Re: [sqlalchemy] Do passive deletes apply to many to many relationships?

2014-05-15 Thread Michael Bayer
On May 15, 2014, at 12:28 AM, Randy Syring ra...@thesyrings.us wrote: I am trying to get SQLAlchemy to let my database's foreign keys on delete cascade do the cleanup on the association table between two objects. I have setup the cascade and passive_delete options on the relationship as

Re: [sqlalchemy] bindparams fails for the table

2014-05-15 Thread Michael Bayer
a SQL statement cannot use a bound parameter as a substitute for SQL identifiers, such as table and column names. that is, this is not valid: conn.execute(select * from :table, table='foo') bound parameters are only intended for literal values used in SQL expressions, that is, the *data*, not

Re: [sqlalchemy] How do you limit/specify the columns that are loaded via a relationship()?

2014-05-15 Thread Jonathan Vanasco
that's not too bad. at least for me; i only defer a few HSTORE columns. On Thursday, May 15, 2014 2:24:51 PM UTC-4, Michael Bayer wrote: yeah there’s some bad history with the API here, in that you can’t easily pass them all at once, but right now it’s q.options(undefer(‘*’)) for

[sqlalchemy] Is there a way to get the number of active/closed sessions in a scoped_session object?

2014-05-15 Thread Bao Niu
Hi, I've looked up the scoped_session api documentation, but didn't find a method to return the current number of active and/or closed sessions residing in a scoped_session object. Is there a simple way to achieve this? This is for testing reason. -- You received this message because you are

Re: [sqlalchemy] Advice for Method to consistently import XML into SQLAlchemy

2014-05-15 Thread Sayth Renshaw
Is there an advantage to using xslt compared to converting it to something like json? Sayth On 16/05/2014 3:37 am, AM ams@gmail.com wrote: On 05/14/2014 04:23 AM, Sayth Renshaw wrote: Hi Looking for some guidance and advice on using xml as an update source for my to be data web

Re: [sqlalchemy] Advice for Method to consistently import XML into SQLAlchemy

2014-05-15 Thread Michael Bayer
not really reading this thread since it isn't too SQLA specific but if you're parsing XML, unless you have unusual memory/performance requirements you just use lxml with etree to set up a DOM, and that's it. On May 15, 2014, at 5:33 PM, Sayth Renshaw flebber.c...@gmail.com wrote: Is there

Re: [sqlalchemy] Advice for Method to consistently import XML into SQLAlchemy

2014-05-15 Thread Sayth Renshaw
The part I am not understanding though is what does SqlAlchemy want my data to look like to be an acceptable format. I know how to create my models and db in SqlAlchemy and though I am a beginner at etree can use it but can't find examples to see what my end goal should look like. Sayth On

Re: [sqlalchemy] Advice for Method to consistently import XML into SQLAlchemy

2014-05-15 Thread Jonathan Rogers
Sayth Renshaw wrote: The part I am not understanding though is what does SqlAlchemy want my data to look like to be an acceptable format. I know how to create my models and db in SqlAlchemy and though I am a beginner at etree can use it but can't find examples to see what my end goal should