[sqlalchemy] Re: creating a database through SQLAlchemy

2007-08-30 Thread Mike Orr
On 8/30/07, Travis Kriplean <[EMAIL PROTECTED]> wrote: > I'd like to use SQLAlchemy to connect to a db server, create a > database, and then start using it. However, it appears that the > SQLAlchemy api assumes the existence of a database to connect to. I'm > able to connect to the server without

[sqlalchemy] creating a database through SQLAlchemy

2007-08-30 Thread Travis Kriplean
Hi all, I'd like to use SQLAlchemy to connect to a db server, create a database, and then start using it. However, it appears that the SQLAlchemy api assumes the existence of a database to connect to. I'm able to connect to the server without a database specified: >>> con = 'postgres://postgres:

[sqlalchemy] Re: Testing for validity of a Connection

2007-08-30 Thread Mike Orr
On 8/30/07, Moshe C. <[EMAIL PROTECTED]> wrote: > > I was hoping there was something more elegant than just trying and > catching a possible exception. > The motivation is just simpler and more readable code like > if not connection.is_valid(): >get another one The issue is that in a packet-b

[sqlalchemy] Re: Testing for validity of a Connection

2007-08-30 Thread Moshe C.
I was hoping there was something more elegant than just trying and catching a possible exception. The motivation is just simpler and more readable code like if not connection.is_valid(): get another one On Aug 30, 5:25 pm, "Paul Johnston" <[EMAIL PROTECTED]> wrote: > How about, conn.execute(

[sqlalchemy] Re: TEXT Column type

2007-08-30 Thread voltron
Thanks! On Aug 30, 10:13 pm, jason kirtland <[EMAIL PROTECTED]> wrote: > voltron wrote: > > > Hi all > > > What do I have to import to be able to use the column type TEXT? > > from sqlalchemy import Column, TEXT > Column('mytext', TEXT) > > or use 'String' without a length qualifier: > > fr

[sqlalchemy] Re: TEXT Column type

2007-08-30 Thread jason kirtland
voltron wrote: > > Hi all > > What do I have to import to be able to use the column type TEXT? from sqlalchemy import Column, TEXT Column('mytext', TEXT) or use 'String' without a length qualifier: from sqlalchemy import Column, String Column('mytext', String) --~--~-~--~~

[sqlalchemy] Re: TEXT Column type

2007-08-30 Thread voltron
is this correct? import sqlalchemy.types as types On Aug 30, 10:07 pm, voltron <[EMAIL PROTECTED]> wrote: > Hi all > > What do I have to import to be able to use the column type TEXT? --~--~-~--~~~---~--~~ You received this message because you are subscribed to

[sqlalchemy] TEXT Column type

2007-08-30 Thread voltron
Hi all What do I have to import to be able to use the column type TEXT? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To post to this group, send email to sqlalchemy@googlegroups.com To unsubs

[sqlalchemy] Re: connection strategy

2007-08-30 Thread Randall Smith
> session.execute(statement) ? Perfect. Thanks so much. Randall Michael Bayer wrote: > > On Aug 30, 2007, at 2:46 PM, Randall Smith wrote: > >> After some testing, the example I gave did not work properly. queries >> executed with con did not reflect changes made in a session >> transact

[sqlalchemy] Re: connection strategy

2007-08-30 Thread Michael Bayer
On Aug 30, 2007, at 2:46 PM, Randall Smith wrote: > > After some testing, the example I gave did not work properly. queries > executed with con did not reflect changes made in a session > transaction. > This does seem to work: > > sess = object_session(self) > con = sess.c

[sqlalchemy] Re: connection strategy

2007-08-30 Thread Randall Smith
After some testing, the example I gave did not work properly. queries executed with con did not reflect changes made in a session transaction. This does seem to work: sess = object_session(self) con = sess.connection(self.mapper) Seems messy. self.mapper only exists becau

[sqlalchemy] Re: connection strategy

2007-08-30 Thread Michael Bayer
use sess.connection(self.__class__). that will return whatever connection is specific to that class' mapper within any current transactions. On Aug 30, 2007, at 2:20 PM, Randall Smith wrote: > > I'm wondering what is the best way for a mapped object to acquire a > connection for a non-ORM s

[sqlalchemy] Re: connection strategy

2007-08-30 Thread Randall Smith
Typo in untested example. session should be sess. Randall Randall Smith wrote: > I'm wondering what is the best way for a mapped object to acquire a > connection for a non-ORM style query while staying within the context > (reuse connection or transaction) of its own session. For example, he

[sqlalchemy] connection strategy

2007-08-30 Thread Randall Smith
I'm wondering what is the best way for a mapped object to acquire a connection for a non-ORM style query while staying within the context (reuse connection or transaction) of its own session. For example, here is a method of a mapped object. @property def analysis_count(self):

[sqlalchemy] Re: outerjoin constructor throws exception from 0.3.9. Bug or user error?

2007-08-30 Thread Michael Bayer
On Aug 27, 2007, at 1:16 PM, mc wrote: > > Hi, > I have the following two tables (in MySql): > > CREATE TABLE `A` ( > `xkey` varchar(200) NOT NULL, > `yval` int(11) default NULL, > PRIMARY KEY (`xkey`) > ) ENGINE=InnoDB; > > and > > CREATE TABLE `B` ( > `xkey` varchar(200) NOT NULL defa

[sqlalchemy] Re: How to construct a dialect-aware user type

2007-08-30 Thread Michael Bayer
On Aug 30, 2007, at 8:20 AM, marq wrote: > > Hello, > > apologies if I'm the obvious or important things in the documentation > - and I'm obviously very new to SQLAlchemy... > > I'd like to create my own types which are aware of different database > dialects. For example, I need a type 'Double'

[sqlalchemy] Re: SA 0.4 orm mapped class 'instrumentation time'

2007-08-30 Thread Michael Bayer
On Aug 30, 2007, at 2:17 AM, Marco De Felice wrote: > > Michael Bayer ha scritto: >> its most likely uncompiled mappers. the "c" attribute on the class >> is deprecated; use Table.attribute instead. >> ... > > Thanks, but it seems the Table.c.attribute has a .op() method that I > can't find on

[sqlalchemy] Re: Testing for validity of a Connection

2007-08-30 Thread Paul Johnston
How about, conn.execute('select 1') On 8/30/07, Moshe C. <[EMAIL PROTECTED]> wrote: > > > How can I test whether a connection object is valid and hasn't, for > example, been time outed by the server? > > > > > --~--~-~--~~~---~--~~ You received this message because

[sqlalchemy] Re: outerjoin constructor throws exception from 0.3.9. Bug or user error?

2007-08-30 Thread Moshe C.
Raising this after 3 days, still hoping for help :-) --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To post to this group, send email to sqlalchemy@googlegroups.com To unsubscribe from this grou

[sqlalchemy] Testing for validity of a Connection

2007-08-30 Thread Moshe C.
How can I test whether a connection object is valid and hasn't, for example, been time outed by the server? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To post to this group, send email to sq

[sqlalchemy] Re: How to construct a dialect-aware user type

2007-08-30 Thread svilen
IMO current way as of src (sorry i havent read docs at user level), u'll need two-side implementaion - one abstract SA, and one dialect-dependent. In each dialect, there are 2 mappings: one abstractSAtype->specificDialectType (look for something named colspecs), and another one used for reflec

[sqlalchemy] How to construct a dialect-aware user type

2007-08-30 Thread marq
Hello, apologies if I'm the obvious or important things in the documentation - and I'm obviously very new to SQLAlchemy... I'd like to create my own types which are aware of different database dialects. For example, I need a type 'Double' which holds a representation of a double precision floati

[sqlalchemy] Solved: Updating the sequence number

2007-08-30 Thread alex.schenkman
I have found the answer: table.update(values={table.c.id:myNewSequenceNumber}).execute() On Aug 29, 4:33 pm, "alex.schenkman" <[EMAIL PROTECTED]> wrote: > Hi: > > I'm new to SQL. > I have to execute the following SQL line, which updates a sequence > number. The table zseq_document_types_lookup