[sqlalchemy] Re: SQLAlchemy & Teradata

2016-12-06 Thread Mark Sandan
There is also a tutorial 
here 
https://developer.teradata.com/tools/articles/teradata-sqlalchemy-introduction

It's a hands on way of getting started with SQLAlchemy but using the 
Teradata Dialect. I wrote it in such a way so that the details of the 
dialect aren't that significant so hopefully it is also useful to other 
SQLAlchemy noobs like myself!

-- 
SQLAlchemy - 
The Python SQL Toolkit and Object Relational Mapper

http://www.sqlalchemy.org/

To post example code, please provide an MCVE: Minimal, Complete, and Verifiable 
Example.  See  http://stackoverflow.com/help/mcve for a full description.
--- 
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 https://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.


[sqlalchemy] SQLAlchemy & Teradata

2016-11-30 Thread Mark Sandan
Hello group, I'd like to announce a dialect for the Teradata database!

I'm still learning a lot about SQLAlchemy and ORMs in general. The dialect 
isn't "production" ready per se but it provides a functioning base for 
future Dialects against Teradata. 

I have a gitter: https://gitter.im/sandan/sqlalchemy-teradata for your 
comments, questions, and suggestions. 
Please feel free to open issues/bugs and pull 
requests: https://github.com/Teradata/sqlalchemy-teradata

-- 
SQLAlchemy - 
The Python SQL Toolkit and Object Relational Mapper

http://www.sqlalchemy.org/

To post example code, please provide an MCVE: Minimal, Complete, and Verifiable 
Example.  See  http://stackoverflow.com/help/mcve for a full description.
--- 
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 https://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.


Re: [sqlalchemy] Dialects supporting autocommit in the current session

2016-09-27 Thread Mark Sandan
Thanks! I'll check it out. I wanted to write an application that made sure 
to autocommit for various database backends or else if those backends 
already support it, then don't autocommit. I will check out 
the set_isolation_level() method.

On Tuesday, September 27, 2016 at 7:34:29 AM UTC-7, Mike Bayer wrote:
>
>
> On 09/26/2016 09:25 PM, Mark Sandan wrote: 
> > Hi, 
> >   I was wondering if there exists a dialect-wide way to query whether 
> > the underlying database is in a transaction mode that requires an 
> > autocommit or not. In Teradata, there is this notion of a transaction 
> > mode. When a session in Teradata is in a certain transaction mode 
> > (TDBS), autocommits are used (the COMMIT is implicit). Alternatively, 
> > when in ANSI mode, a COMMIT must explicitly be specified for the end of 
> > a transaction (or ROLLBACK or ABORT). I'm wondering if it would be 
> > useful to have something like below in the Dialect interface: 
>
> SQLAlchemy's support for "autocommit" at the DBAPI level is via the 
> set_isolation_level() method which internally will set a DBAPI level 
> conn.autocommit flag if that's how the DBAPI needs it to happen.  It is 
> only supported by Postgresql and MySQL.  But none of these "require" 
> autocommit, it's a flag the user can set, so I'm not sure what you're 
> asking. 
>
> > 
> > | 
> > defconn_supports_autocommit(self,connection,**kw): 
> >""" 
> >returns true if the current underlying database session autocommits 
> > else false 
> >""" 
> > | 
> > 
> > Or if there is already something that effectively does this. 
> > 
> > Thanks! 
> > 
> > -- 
> > 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  
> > <mailto:sqlalchemy+unsubscr...@googlegroups.com >. 
> > To post to this group, send email to sqlal...@googlegroups.com 
>  
> > <mailto:sqlal...@googlegroups.com >. 
> > Visit this group at https://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 https://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.


[sqlalchemy] Dialects supporting autocommit in the current session

2016-09-26 Thread Mark Sandan
Hi,
  I was wondering if there exists a dialect-wide way to query whether the 
underlying database is in a transaction mode that requires an autocommit or 
not. In Teradata, there is this notion of a transaction mode. When a 
session in Teradata is in a certain transaction mode (TDBS), autocommits 
are used (the COMMIT is implicit). Alternatively, when in ANSI mode, a 
COMMIT must explicitly be specified for the end of a transaction (or 
ROLLBACK or ABORT). I'm wondering if it would be useful to have something 
like below in the Dialect interface:

def conn_supports_autocommit(self, connection, **kw):
   """
   returns true if the current underlying database session autocommits else 
false
   """

Or if there is already something that effectively does this.

Thanks!

-- 
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 https://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.


Re: [sqlalchemy] Create Table DDL options before "("

2016-05-23 Thread Mark Sandan
No worries, I'll put up a reference to the PR and gerrit proposal in case 
anybody wants to chime in. The change is proposed in git PR #275 
<https://github.com/zzzeek/sqlalchemy/pull/275> and in gerrit 
<https://gerrit.sqlalchemy.org/#/c/85/1> (which I'm still getting used too).


On Sunday, May 22, 2016 at 8:23:14 PM UTC-7, Mike Bayer wrote:
>
> OK so we'll probably just add the hook you've proposed. 
>
> I've not had anytime to work on a computer for like five days straight 
> which puts me super behind, ill try to get to your PR soon. 
>
>
> On 05/19/2016 01:08 PM, Mark Sandan wrote: 
> > Sure, the Teradata database has create table ddl where you can specify 
> > certain options that are separated by commas. We have a reference manual 
> > available online specifying the full DDL here 
> > <
> https://www.google.com/url?sa=t=j==s=web=1=rja=8=0ahUKEwjZkreizubMAhVIXh4KHWp0DrAQFggdMAA=http%3A%2F%2Ftunweb.teradata.ws%2Ftunstudent%2FTeradataUserManuals%2FSQL_Reference_--_Data_Definition_Syntax_Example.pdf=AFQjCNFEIVA1TfbRXNV_hQfCVNBe7gZt3g=dPP1GmBUBEyB186Pkh6HmA>
>  
> (see 
> > page 383 for the full syntax).  Here is some example DDL: 
> > 
> > | 
> > CREATE TABLE t1 ,FALLBACK , 
> >  NO BEFORE JOURNAL, 
> >  NO AFTER JOURNAL, 
> >  CHECKSUM = DEFAULT, 
> >  DEFAULT MERGEBLOCKRATIO 
> >  ( 
> >   c1 VARCHAR(128) NOT NULL, 
> >   Id BYTE(4) NOT NULL, 
> >   OwnerId BYTE(4) NOT NULL 
> >  ) 
> >UNIQUE PRIMARY INDEX ( c1 ) 
> >  UNIQUE INDEX ( Id ); 
> > | 
> > 
> > 
> > 
> > On Thursday, May 19, 2016 at 8:31:49 AM UTC-7, Mike Bayer wrote: 
> > 
> > saw your pull request, just curious what database / DDL is this? 
>  Just 
> > like to see the finished product that you're going for. 
> > 
> > 
> > 
> > On 05/18/2016 09:19 PM, Mark Sandan wrote: 
> > > Hi, I'm implementing a dialect for sqlalchemy and would like to 
> add 
> > > options before the '(' but after the table name in visit_create. I 
> > know 
> > > I can just subclass visit_create in my ddl compiler but it seems 
> > kind of 
> > > silly since I'd be making a small change. Something like the 
> > following: 
> > > | 
> > > 
> > > 
> > > defvisit_create_table(self,create): 
> > >   table =create.element 
> > >   preparer =self.preparer 
> > > 
> > >   text ="\nCREATE " 
> > >   iftable._prefixes: 
> > >  text +=" ".join(table._prefixes)+" " 
> > >   text +="TABLE "+preparer.format_table(table)+" 
> > "+table_options(table)+" (" 
> > > 
> > > | 
> > > 
> > > table_options would be a function in the ddl compiler provided by 
> the 
> > > dialect that takes dialect specific keywords and simply appends 
> comma 
> > > delimited values. I essentially need something like the 'prefixes' 
> > > keyword in Table but for after the table name and before the left 
> > > parens. Any ideas? 
> > > 
> > > -- 
> > > 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  
> > > <mailto:sqlalchemy+unsubscr...@googlegroups.com  
> >. 
> > > To post to this group, send email to sqlal...@googlegroups.com 
> >  
> > > <mailto:sqlal...@googlegroups.com >. 
> > > Visit this group at https://groups.google.com/group/sqlalchemy 
> > <https://groups.google.com/group/sqlalchemy>. 
> > > For more options, visit https://groups.google.com/d/optout 
> > <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+...@googlegroups.com  
> > <mailto:sqlalchemy+unsubscr...@googlegroups.com >. 
> > To post to this group, send email to sqlal...@googlegroups.com 
>  
> > <mailto:sqlal...@googlegroups.com >. 
> > Visit this group at https://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 https://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.


[sqlalchemy] Re: Is there a good doc page/tutorial for writing a dialect?

2016-05-20 Thread Mark Sandan
 I recommend Mike's article from the open source architecture book 
. It helped me understand where 
dialects fall in relation to the other SQLAlchemy components and it 
provided a great overview in general. I bootstrapped off of what other 
dialects did and tried to implement as much as I could to get enough 
functionality from the Core tutorial 
 working. Hope it 
helps.

On Thursday, May 19, 2016 at 2:20:57 PM UTC-7, John Omernik wrote:
>
> I am trying to write a new dialect, and while many things are fairly 
> obvious, many are also not. It would be helpful to point to some docs on 
> how the dialect writing works, what events/methods we can overwrite and 
> what it can help us do. 
>
>
> Thanks!
>
> John
>

-- 
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 https://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.


Re: [sqlalchemy] Create Table DDL options before "("

2016-05-19 Thread Mark Sandan
Sure, the Teradata database has create table ddl where you can specify 
certain options that are separated by commas. We have a reference manual 
available online specifying the full DDL here 
<https://www.google.com/url?sa=t=j==s=web=1=rja=8=0ahUKEwjZkreizubMAhVIXh4KHWp0DrAQFggdMAA=http%3A%2F%2Ftunweb.teradata.ws%2Ftunstudent%2FTeradataUserManuals%2FSQL_Reference_--_Data_Definition_Syntax_Example.pdf=AFQjCNFEIVA1TfbRXNV_hQfCVNBe7gZt3g=dPP1GmBUBEyB186Pkh6HmA>
 (see 
page 383 for the full syntax).  Here is some example DDL:

CREATE TABLE t1 ,FALLBACK ,
 NO BEFORE JOURNAL,
 NO AFTER JOURNAL,
 CHECKSUM = DEFAULT,
 DEFAULT MERGEBLOCKRATIO
 (
  c1 VARCHAR(128) NOT NULL,
  Id BYTE(4) NOT NULL,
  OwnerId BYTE(4) NOT NULL
 )
   UNIQUE PRIMARY INDEX ( c1 )
 UNIQUE INDEX ( Id );



On Thursday, May 19, 2016 at 8:31:49 AM UTC-7, Mike Bayer wrote:
>
> saw your pull request, just curious what database / DDL is this?  Just 
> like to see the finished product that you're going for. 
>
>
>
> On 05/18/2016 09:19 PM, Mark Sandan wrote: 
> > Hi, I'm implementing a dialect for sqlalchemy and would like to add 
> > options before the '(' but after the table name in visit_create. I know 
> > I can just subclass visit_create in my ddl compiler but it seems kind of 
> > silly since I'd be making a small change. Something like the following: 
> > | 
> > 
> > 
> > defvisit_create_table(self,create): 
> >   table =create.element 
> >   preparer =self.preparer 
> > 
> >   text ="\nCREATE " 
> >   iftable._prefixes: 
> >  text +=" ".join(table._prefixes)+" " 
> >   text +="TABLE "+preparer.format_table(table)+" 
> "+table_options(table)+" (" 
> > 
> > | 
> > 
> > table_options would be a function in the ddl compiler provided by the 
> > dialect that takes dialect specific keywords and simply appends comma 
> > delimited values. I essentially need something like the 'prefixes' 
> > keyword in Table but for after the table name and before the left 
> > parens. Any ideas? 
> > 
> > -- 
> > 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  
> > <mailto:sqlalchemy+unsubscr...@googlegroups.com >. 
> > To post to this group, send email to sqlal...@googlegroups.com 
>  
> > <mailto:sqlal...@googlegroups.com >. 
> > Visit this group at https://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 https://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.


[sqlalchemy] Create Table DDL options before "("

2016-05-18 Thread Mark Sandan
Hi, I'm implementing a dialect for sqlalchemy and would like to add options 
before the '(' but after the table name in visit_create. I know I can just 
subclass visit_create in my ddl compiler but it seems kind of silly since 
I'd be making a small change. Something like the following:


def visit_create_table(self, create): 
  table = create.element
  preparer = self.preparer
 
  text = "\nCREATE "
  if table._prefixes:
 text += " ".join(table._prefixes) + " "
  text += "TABLE " + preparer.format_table(table)+ " " + table_options(table
) + " ("


table_options would be a function in the ddl compiler provided by the 
dialect that takes dialect specific keywords and simply appends comma 
delimited values. I essentially need something like the 'prefixes' keyword 
in Table but for after the table name and before the left parens. Any ideas?

-- 
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 https://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.