nameko-sqlalchemy and autoload

Hi,

Pretty sure this is an easy one, but I've gone code-blind...

I'm trying to connect nameko-sqlalchemy to an existing database, and so am
trying out sqlalchemy's autoload feature. My first attempts have resulted
in the error:

No engine is bound to this Table's MetaData. Pass an engine to the Table
via autoload_with=<someengine>, or associate the MetaData with an engine
via metadata.bind=<someengine>

... which I get. I understand what it's telling me, but I'm trying to
figure out how to do this within the structure of the nameko-sqlalchemy
provider.

Could anyone point me in the right direction?

Thanks,
Chris

And as an aside, what's the suggested method for calling a sproc when using
nameko-sqlalchemy?

I've found I can reach 'execute' via *self.db.session.bind.execute(...)* but
perhaps there's a cleaner way?

Thanks!
Chris

Hi Chris,

I've never used to auto-reload feature. It's possible it doesn't work with
the structure of nameko-sqlalchemy, although I'd be surprised. Hard to say
just from the error. Can you post more code?

Re: stored procedures, I'm not sure there is an established way. With
*self.db.session.bind.execute()* are you using the newer "Database" DP or
the older "DatabaseSession" one?

Matt.

···

On Tuesday, July 24, 2018 at 4:28:06 PM UTC+1, Chris Platts wrote:

And as an aside, what's the suggested method for calling a sproc when
using nameko-sqlalchemy?

I've found I can reach 'execute' via *self.db.session.bind.execute(...)* but
perhaps there's a cleaner way?

Thanks!
Chris

Thanks, Matt.

I’ll sort out an example at work next week. I ended up just going the regular route and defining the models as per normal. It’d still be great to figure out stored procs – and yes, I’m using the newer Database provider.

Chris