[sqlalchemy] Dialect Python package name convension

2016-06-03 Thread Shige Takeda
Is there any package naming convention for SQLAlchemy dialect? I found some are named: sqlalchemy- e.g., sqlalchemy-redshift, sqlalchemy-vertica,... while others are: -sqlalchemy I'm building one for our company's db, snowflake, and wondering which name I should choose... Any advice would be

Re: [sqlalchemy] Calculated relationships

2016-06-03 Thread Andrew Pashkin
Bump -- 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.

Re: [sqlalchemy] sqlalchemy + pyodbc + sybase issue with automap_base().prepare()

2016-06-03 Thread Mike Bayer
you have a FreeTDS problem at this point and you need to contact them at http://lists.ibiblio.org/mailman/listinfo/freetds for further help. On 06/03/2016 04:49 PM, Brad Hudson wrote: I'm thoroughly confused. It seems that the connection is complaining about a "[Microsoft][ODBC Driver

Re: [sqlalchemy] sqlalchemy + pyodbc + sybase issue with automap_base().prepare()

2016-06-03 Thread Brad Hudson
I'm thoroughly confused. It seems that the connection is complaining about a "[Microsoft][ODBC Driver Manager]" issue when my DSN is clearly using the "Adaptive Server Enterprise" driver.

Re: [sqlalchemy] sqlalchemy + pyodbc + sybase issue with automap_base().prepare()

2016-06-03 Thread Brad Hudson
I thoroughly confused. It seems that the connection error is complaining about a "[Microsoft][ODBC Driver Manager]" when my DSN is specifically configured for the "Adaptive Server Enterprise" driver.

Re: [sqlalchemy] Is there a way to create custom classes that inherit from sqlalchemy models in external library?

2016-06-03 Thread Mike Bayer
On 06/03/2016 02:44 PM, Angie E wrote: Rather than creating mixin classes that models inherit from, I have a use case that requires me to configure classes the other way around. The classes that would normally be mixin classes need to be the classes that inherit from the models as well as the

[sqlalchemy] Is there a way to create custom classes that inherit from sqlalchemy models in external library?

2016-06-03 Thread Angie E
Rather than creating mixin classes that models inherit from, I have a use case that requires me to configure classes the other way around. The classes that would normally be mixin classes need to be the classes that inherit from the models as well as the class that model objects are created

Re: [sqlalchemy] sqlalchemy + pyodbc + sybase issue with automap_base().prepare()

2016-06-03 Thread Brad Hudson
Thanks for that, it definitely fails on the connect, but I don't understand why it's failing and complaining about a [Microsoft][ODBC Driver Manager] issue when I've tried both FreeTDS and Adaptive Server Enterprise? On Friday, June 3, 2016 at 10:21:18 AM UTC-5, Mike Bayer wrote: > > > >

[sqlalchemy] Re: confused on optimal use of engine vs connection

2016-06-03 Thread Jonathan Vanasco
On Friday, June 3, 2016 at 7:49:23 AM UTC-4, Krishnakant wrote: > > So it will have no performance difference is it? > > If both do same thing then how and why will explicit connection help me > better? > the `engine.execute()` will be slower, because you will be creating/checking-out a

Re: [sqlalchemy] Eager-load a CTE via relationship or column property

2016-06-03 Thread Mike Bayer
On 06/03/2016 11:18 AM, Adrian wrote: I think there's a misunderstanding - I don't want to manually populate the relationship, I want to avoid spamming queries if I get e.g. 10 categories and need the parent chains for all of them. Here's a pseudo-ish example of what I'd like to do (without

Re: [sqlalchemy] sqlalchemy + pyodbc + sybase issue with automap_base().prepare()

2016-06-03 Thread Mike Bayer
On 06/03/2016 11:15 AM, Brad Hudson wrote: Mike: First, thank you very much for the response. However, it doesn't appear to be an issue with the connection string, but with the automap_base() function itself. Please see my modified results below: this is a simple connection failure.

Re: [sqlalchemy] Eager-load a CTE via relationship or column property

2016-06-03 Thread Adrian
I think there's a misunderstanding - I don't want to manually populate the relationship, I want to avoid spamming queries if I get e.g. 10 categories and need the parent chains for all of them. Here's a pseudo-ish example of what I'd like to do (without queries in the loop): categories =

Re: [sqlalchemy] sqlalchemy + pyodbc + sybase issue with automap_base().prepare()

2016-06-03 Thread Brad Hudson
Mike: First, thank you very much for the response. However, it doesn't appear to be an issue with the connection string, but with the automap_base() function itself. Please see my modified results below: Python 3.5.1 |Continuum Analytics, Inc.| (default, Feb 16 2016, 09:49:46) [MSC v.1900 64

Re: [sqlalchemy] Eager-load a CTE via relationship or column property

2016-06-03 Thread Mike Bayer
you would first set up a traditional adjacency list relationship as in http://docs.sqlalchemy.org/en/latest/orm/self_referential.html?highlight=adjacency%20list. Second, as you run this query you can retrieve Category objects fully, however they will be in a straight down list. As you

[sqlalchemy] Eager-load a CTE via relationship or column property

2016-06-03 Thread Adrian
I have a Category model that has (among other things) a `id` and `parent_id` since my categories are organized in a tree. @property def chain_query(self): """Get a query object for the category chain. The query retrieves the root category first and then all the

Re: Getting the current dialect name in a migration

2016-06-03 Thread Michal Petrucha
On Fri, Jun 03, 2016 at 10:24:23AM -0400, Mike Bayer wrote: > > > op.get_bind().engine.name /me hangs his head in shame. Thanks, I probably should have tried that. -- You received this message because you are subscribed to the Google Groups "sqlalchemy-alembic" group. To unsubscribe from

Re: Getting the current dialect name in a migration

2016-06-03 Thread Mike Bayer
op.get_bind().engine.name On 06/03/2016 10:21 AM, Michal Petrucha wrote: On Fri, Jun 03, 2016 at 10:05:31AM -0400, Mike Bayer wrote: op.get_bind().name should do it Alas, I have already tried that: if op.get_bind().name == 'postgresql': AttributeError: 'Connection' object has no

Re: [sqlalchemy] sqlalchemy + pyodbc + sybase issue with automap_base().prepare()

2016-06-03 Thread Mike Bayer
this is supported by just passing all key/value pairs: >>> from sqlalchemy.dialects.sybase import pyodbc >>> dialect = pyodbc.SybaseDialect_pyodbc() >>> from sqlalchemy.engine import url >>> u = url.make_url("sybase+pyodbc:///?user=myuser=mypwd=my.db.server=mydb=FreeTDS=1433_Version=8.0")

Re: Getting the current dialect name in a migration

2016-06-03 Thread Michal Petrucha
On Fri, Jun 03, 2016 at 10:05:31AM -0400, Mike Bayer wrote: > op.get_bind().name should do it Alas, I have already tried that: if op.get_bind().name == 'postgresql': AttributeError: 'Connection' object has no attribute 'name' Michal -- You received this message because you are subscribed

Re: Getting the current dialect name in a migration

2016-06-03 Thread Mike Bayer
op.get_bind().name should do it On 06/03/2016 03:25 AM, Michal Petrucha wrote: Hi everyone, I remember seeing a quick expression that extracts the name of the dialect in use from alembic.op, but I can't find it anywhere now, and I can't figure it out by myself either. Does anybody know the

[sqlalchemy] sqlalchemy + pyodbc + sybase issue with automap_base().prepare()

2016-06-03 Thread Brad Hudson
Can anyone help with forming a proper connection to Sybase ASE 15.7? I have tried variations of the following unsuccessfully using examples from the following URLs: - http://stackoverflow.com/questions/4493614/sqlalchemy-equivalent-of-pyodbc-connect-string-using-freetds -

[sqlalchemy] Re: confused on optimal use of engine vs connection

2016-06-03 Thread Krishnakant
On Friday 03 June 2016 04:44 AM, Jonathan Vanasco wrote: as the docs state, `engine.execute(foo)` is shorthand for "connection = engine.connect()" + "connection.execute(foo)". you can verify this in the source. So it will have no performance difference is it? for what you describe, it's

Getting the current dialect name in a migration

2016-06-03 Thread Michal Petrucha
Hi everyone, I remember seeing a quick expression that extracts the name of the dialect in use from alembic.op, but I can't find it anywhere now, and I can't figure it out by myself either. Does anybody know the right chain of attributes and/or method calls to follow from alembic.op to get to