[sqlalchemy] Re: MSSQL Reflection Error

2009-01-23 Thread Greg

The commit mentioned earlier fixed the issue. Thanks for all the 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 group, send email to 
sqlalchemy+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~--~~~~--~~--~--~---




[sqlalchemy] Re: MSSQL Reflection Error

2009-01-23 Thread Greg

Thanks, I'll try this out and let you know how it goes.

On Jan 23, 12:43 pm, Rick Morrison  wrote:
> Uh, did you guys not see my last message in this thread?
--~--~-~--~~~---~--~~
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 group, send email to 
sqlalchemy+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~--~~~~--~~--~--~---



[sqlalchemy] Re: MSSQL Reflection Error

2009-01-23 Thread Greg

Yeah, I can get it to you, but in the reply box I'm not seeing
anything here about attachments. There's just Send, Discard, Add Cc,
or Edit Subject. I am set up to use this group only through the
browser.

On Jan 23, 12:35 pm, Don Dwiggins  wrote:
> Greg wrote:
> > I think I found one that might help. Where can I upload this HTML file
> > it generated?
>
> In case you don't get a better answer: open the file in your browser,
> then cut & paste the text the browser displays (or take a screenshot of
> the browser window and upload that as a gif or jpg).
>
> --
> Don Dwiggins
> Advanced Publishing Technology
--~--~-~--~~~---~--~~
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 group, send email to 
sqlalchemy+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~--~~~~--~~--~--~---



[sqlalchemy] Re: MSSQL Reflection Error

2009-01-23 Thread Rick Morrison
Uh, did you guys not see my last message in this thread?

--~--~-~--~~~---~--~~
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 group, send email to 
sqlalchemy+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~--~~~~--~~--~--~---



[sqlalchemy] Re: MSSQL Reflection Error

2009-01-23 Thread Don Dwiggins

Greg wrote:
> I think I found one that might help. Where can I upload this HTML file
> it generated?

In case you don't get a better answer: open the file in your browser, 
then cut & paste the text the browser displays (or take a screenshot of 
the browser window and upload that as a gif or jpg).


-- 
Don Dwiggins
Advanced Publishing Technology


--~--~-~--~~~---~--~~
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 group, send email to 
sqlalchemy+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~--~~~~--~~--~--~---



[sqlalchemy] Re: MSSQL Reflection Error

2009-01-22 Thread Rick Morrison
Please try r5718, it contains an updated method of column construction that
should fix this issue.

Rick

--~--~-~--~~~---~--~~
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 group, send email to 
sqlalchemy+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~--~~~~--~~--~--~---



[sqlalchemy] Re: MSSQL Reflection Error

2009-01-22 Thread Greg

I think I found one that might help. Where can I upload this HTML file
it generated?

On Jan 22, 12:57 pm, Don Dwiggins  wrote:
> Greg wrote:
> > Unfortunately, I'm connecting remotely via iODBC and do not have said
> > tools. I'm running Ubuntu Linux, if you know of any way to get the
> > same thing prettied up, let me know and I will.
>
> Ahh, sorry; I've never had occasion to work with MSSQL through Linux.
> Maybe the best approach would be to use a Python shell to run the
> sp_columns proc and format the results yourself.  (Or, you might check
> whether there are already some decent Linux GUI tools like Query Analyzer.)
>
> FWIW,
> --
> Don Dwiggins
> Advanced Publishing Technology
--~--~-~--~~~---~--~~
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 group, send email to 
sqlalchemy+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~--~~~~--~~--~--~---



[sqlalchemy] Re: MSSQL Reflection Error

2009-01-22 Thread Don Dwiggins

Greg wrote:
> Unfortunately, I'm connecting remotely via iODBC and do not have said
> tools. I'm running Ubuntu Linux, if you know of any way to get the
> same thing prettied up, let me know and I will.

Ahh, sorry; I've never had occasion to work with MSSQL through Linux.
Maybe the best approach would be to use a Python shell to run the 
sp_columns proc and format the results yourself.  (Or, you might check 
whether there are already some decent Linux GUI tools like Query Analyzer.)

FWIW,
-- 
Don Dwiggins
Advanced Publishing Technology


--~--~-~--~~~---~--~~
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 group, send email to 
sqlalchemy+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~--~~~~--~~--~--~---



[sqlalchemy] Re: MSSQL Reflection Error

2009-01-21 Thread Rick Morrison
> I think we might need to just change the *args approach in mssql
>> reflecttable to do everything based on keyword arguments
>>
>>
> Yeah, that sounds like a good approach. I'll have a look later today.
>

Attached is an untested patch against trunk that uses only kwargs to build
out the tabledef. I won't be able to test this until late tomorrow, but feel
free to apply and try it out.

Rick

--~--~-~--~~~---~--~~
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 group, send email to 
sqlalchemy+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~--~~~~--~~--~--~---



relect_via_kwargs.patch
Description: Binary data


[sqlalchemy] Re: MSSQL Reflection Error

2009-01-21 Thread Greg

Unfortunately, I'm connecting remotely via iODBC and do not have said
tools. I'm running Ubuntu Linux, if you know of any way to get the
same thing prettied up, let me know and I will.

On Jan 21, 12:22 pm, Don Dwiggins  wrote:
> Greg wrote:
> > As a disclaimer, this is a legacy system in which I have no control
> > over, so what you are about to see is pretty disturbing :)
>
> >http://pastebin.com/m10d49ac1
>
> > The formatting is pretty crazy, I'm hoping you can make use of this.
>
> If you have the MSSQL tools handy, try this:
> - Open Query Analyzer, connect to the server
> - Press F8 to get the Object Browser (unless it's already open
> - Go to the database and table in question.
> - Right click on the table name
> - Select "Script object to new window as"; in the submenu choose Create
>
> You should have a reasonably formatted table creation script, including
> indices and FKs.
>
> HTH,
> --
> Don Dwiggins
> Advanced Publishing Technology
--~--~-~--~~~---~--~~
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 group, send email to 
sqlalchemy+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~--~~~~--~~--~--~---



[sqlalchemy] Re: MSSQL Reflection Error

2009-01-21 Thread Rick Morrison
On Wed, Jan 21, 2009 at 12:16 PM, Michael Bayer wrote:

>
>
> I think we might need to just change the *args approach in mssql
> reflecttable to do everything based on keyword arguments, and add in
> some "isinstance(String) / isinstance(Numeric)" to determine what args
> get sent where.   I can see the "if a is not None:"  on line 1138 not
> being reliable.
>
>
Yeah, that sounds like a good approach. I'll have a look later today.

--~--~-~--~~~---~--~~
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 group, send email to 
sqlalchemy+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~--~~~~--~~--~--~---



[sqlalchemy] Re: MSSQL Reflection Error

2009-01-21 Thread Don Dwiggins

Greg wrote:
> As a disclaimer, this is a legacy system in which I have no control
> over, so what you are about to see is pretty disturbing :)
> 
> http://pastebin.com/m10d49ac1
> 
> The formatting is pretty crazy, I'm hoping you can make use of this.

If you have the MSSQL tools handy, try this:
- Open Query Analyzer, connect to the server
- Press F8 to get the Object Browser (unless it's already open
- Go to the database and table in question.
- Right click on the table name
- Select "Script object to new window as"; in the submenu choose Create

You should have a reasonably formatted table creation script, including 
indices and FKs.

HTH,
-- 
Don Dwiggins
Advanced Publishing Technology


--~--~-~--~~~---~--~~
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 group, send email to 
sqlalchemy+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~--~~~~--~~--~--~---



[sqlalchemy] Re: MSSQL Reflection Error

2009-01-21 Thread Rick Morrison
Hey Greg, please set the output format to text (if you're in mssql 2005,
there's a button over the query window with a tooltip that should say
"Results to text") and re-run the query. The text output will be a lot
easier to read.

Thanks

--~--~-~--~~~---~--~~
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 group, send email to 
sqlalchemy+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~--~~~~--~~--~--~---



[sqlalchemy] Re: MSSQL Reflection Error

2009-01-21 Thread Michael Bayer


I think we might need to just change the *args approach in mssql  
reflecttable to do everything based on keyword arguments, and add in  
some "isinstance(String) / isinstance(Numeric)" to determine what args  
get sent where.   I can see the "if a is not None:"  on line 1138 not  
being reliable.



On Jan 20, 2009, at 4:54 PM, Rick Morrison wrote:

> > I'm just trying to introspect an existing production database, not
> > create any new tables.
>
> The structure of the table is read when reflecting the table: it's  
> likely that an unusual column definition would trigger an error like  
> this, and it would be helpful to someone diagnosing the problem to  
> get a better clue as to what might be happening.
>
>
> >


--~--~-~--~~~---~--~~
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 group, send email to 
sqlalchemy+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~--~~~~--~~--~--~---



[sqlalchemy] Re: MSSQL Reflection Error

2009-01-21 Thread Greg

As a disclaimer, this is a legacy system in which I have no control
over, so what you are about to see is pretty disturbing :)

http://pastebin.com/m10d49ac1

The formatting is pretty crazy, I'm hoping you can make use of this.
--~--~-~--~~~---~--~~
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 group, send email to 
sqlalchemy+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~--~~~~--~~--~--~---



[sqlalchemy] Re: MSSQL Reflection Error

2009-01-21 Thread Rick Morrison
> I guess I'm kind of confused as to how it's supposed to create a table
> that it doesn't even really know about yet.

No, SQLAlchemy is not trying to create the table.

We (the programmers debugging the problem) are trying to create the table
(or at least know what the structure of the table is) in order to diagnose
the problem.

running "exec sp_columns " in an interactve SQL session should
return the details we need.

--~--~-~--~~~---~--~~
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 group, send email to 
sqlalchemy+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~--~~~~--~~--~--~---



[sqlalchemy] Re: MSSQL Reflection Error

2009-01-21 Thread Greg

I guess I'm kind of confused as to how it's supposed to create a table
that it doesn't even really know about yet. It hasn't successfully
reflected the table yet, so shouldn't know anything about its
structure. It seems like it'd just create an empty table at this
point.

engine = create_engine('CONNECTION STRING HERE')
meta = MetaData()
meta.bind = engine
# SQLAlchemy doesn't know about the remote table structure yet, how
will this do us any good?
meta.create_all()

# This is where I get that exception listed earlier. SQLAlche
artreqs = Table('tb_FSAR_Data_SampArtReq', meta, autoload=True,
autoload_with=engine)

On Jan 21, 1:14 am, Michael Bayer  wrote:
> yeah i meant send along the CREATE TABLE to the mailing list here.    
> or a describe, whatever shows us what column type might be failing.
>
> On Jan 20, 2009, at 9:45 PM, Greg wrote:
>
>
>
> > How do I go about doing this? Showing the create table?
>
> > On Jan 20, 4:54 pm, Rick Morrison  wrote:
> >>> I'm just trying to introspect an existing production database, not
> >>> create any new tables.
>
> >> The structure of the table is read when reflecting the table: it's  
> >> likely
> >> that an unusual column definition would trigger an error like this,  
> >> and it
> >> would be helpful to someone diagnosing the problem to get a better  
> >> clue as
> >> to what might be happening.
--~--~-~--~~~---~--~~
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 group, send email to 
sqlalchemy+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~--~~~~--~~--~--~---



[sqlalchemy] Re: MSSQL Reflection Error

2009-01-20 Thread Michael Bayer

yeah i meant send along the CREATE TABLE to the mailing list here. 
or a describe, whatever shows us what column type might be failing.


On Jan 20, 2009, at 9:45 PM, Greg wrote:

>
> How do I go about doing this? Showing the create table?
>
> On Jan 20, 4:54 pm, Rick Morrison  wrote:
>>> I'm just trying to introspect an existing production database, not
>>> create any new tables.
>>
>> The structure of the table is read when reflecting the table: it's  
>> likely
>> that an unusual column definition would trigger an error like this,  
>> and it
>> would be helpful to someone diagnosing the problem to get a better  
>> clue as
>> to what might be happening.
>
> >


--~--~-~--~~~---~--~~
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 group, send email to 
sqlalchemy+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~--~~~~--~~--~--~---



[sqlalchemy] Re: MSSQL Reflection Error

2009-01-20 Thread Greg

How do I go about doing this? Showing the create table?

On Jan 20, 4:54 pm, Rick Morrison  wrote:
> > I'm just trying to introspect an existing production database, not
> > create any new tables.
>
> The structure of the table is read when reflecting the table: it's likely
> that an unusual column definition would trigger an error like this, and it
> would be helpful to someone diagnosing the problem to get a better clue as
> to what might be happening.

--~--~-~--~~~---~--~~
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 group, send email to 
sqlalchemy+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~--~~~~--~~--~--~---



[sqlalchemy] Re: MSSQL Reflection Error

2009-01-20 Thread Rick Morrison
> I'm just trying to introspect an existing production database, not
> create any new tables.

The structure of the table is read when reflecting the table: it's likely
that an unusual column definition would trigger an error like this, and it
would be helpful to someone diagnosing the problem to get a better clue as
to what might be happening.

--~--~-~--~~~---~--~~
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 group, send email to 
sqlalchemy+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~--~~~~--~~--~--~---



[sqlalchemy] Re: MSSQL Reflection Error

2009-01-20 Thread Greg

If I understand, i only need to do that when I want to create a table.
I'm just trying to introspect an existing production database, not
create any new tables.

On Jan 20, 4:37 pm, Michael Bayer  wrote:
> send along what the CREATE TABLE for the table in question looks like.
>
> On Jan 20, 2009, at 4:20 PM, Greg wrote:
>
>
>
> > I've got the following code to reflect an MS SQL 8 database using the
> > latest stable pyodbc, python 2.5, and SQLAlchemy 5.1:
>
> > engine = create_engine('mssql://userXXX:pass...@mydsn', echo=False)
> > meta = MetaData()
> > meta.bind = engine
>
> > artreqs = Table('tb_FSAR_Data_SampArtReq', meta, autoload=True,
> > autoload_with=engine)
>
> > And am getting this error when I run it:
>
> > Traceback (most recent call last):
> >  File "alchemy.py", line 9, in 
> >    artreqs = Table('tb_FSAR_Data_SampArtReq', meta, autoload=True,
> > autoload_with=engine)
> >  File "/usr/lib/python2.5/site-packages/SQLAlchemy-0.5.1-py2.5.egg/
> > sqlalchemy/schema.py", line 113, in __call__
> >    return type.__call__(self, name, metadata, *args, **kwargs)
> >  File "/usr/lib/python2.5/site-packages/SQLAlchemy-0.5.1-py2.5.egg/
> > sqlalchemy/schema.py", line 239, in __init__
> >    autoload_with.reflecttable(self, include_columns=include_columns)
> >  File "/usr/lib/python2.5/site-packages/SQLAlchemy-0.5.1-py2.5.egg/
> > sqlalchemy/engine/base.py", line 1265, in reflecttable
> >    self.dialect.reflecttable(conn, table, include_columns)
> >  File "/usr/lib/python2.5/site-packages/SQLAlchemy-0.5.1-py2.5.egg/
> > sqlalchemy/databases/mssql.py", line 1157, in reflecttable
> >    coltype = coltype(*args, **kwargs)
> > TypeError: __init__() takes at most 2 arguments (3 given)
>
> > Any ideas? I'm not too sure what's going on here.

--~--~-~--~~~---~--~~
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 group, send email to 
sqlalchemy+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~--~~~~--~~--~--~---



[sqlalchemy] Re: MSSQL Reflection Error

2009-01-20 Thread Michael Bayer

send along what the CREATE TABLE for the table in question looks like.


On Jan 20, 2009, at 4:20 PM, Greg wrote:

>
> I've got the following code to reflect an MS SQL 8 database using the
> latest stable pyodbc, python 2.5, and SQLAlchemy 5.1:
>
> engine = create_engine('mssql://userXXX:pass...@mydsn', echo=False)
> meta = MetaData()
> meta.bind = engine
>
> artreqs = Table('tb_FSAR_Data_SampArtReq', meta, autoload=True,
> autoload_with=engine)
>
> And am getting this error when I run it:
>
> Traceback (most recent call last):
>  File "alchemy.py", line 9, in 
>artreqs = Table('tb_FSAR_Data_SampArtReq', meta, autoload=True,
> autoload_with=engine)
>  File "/usr/lib/python2.5/site-packages/SQLAlchemy-0.5.1-py2.5.egg/
> sqlalchemy/schema.py", line 113, in __call__
>return type.__call__(self, name, metadata, *args, **kwargs)
>  File "/usr/lib/python2.5/site-packages/SQLAlchemy-0.5.1-py2.5.egg/
> sqlalchemy/schema.py", line 239, in __init__
>autoload_with.reflecttable(self, include_columns=include_columns)
>  File "/usr/lib/python2.5/site-packages/SQLAlchemy-0.5.1-py2.5.egg/
> sqlalchemy/engine/base.py", line 1265, in reflecttable
>self.dialect.reflecttable(conn, table, include_columns)
>  File "/usr/lib/python2.5/site-packages/SQLAlchemy-0.5.1-py2.5.egg/
> sqlalchemy/databases/mssql.py", line 1157, in reflecttable
>coltype = coltype(*args, **kwargs)
> TypeError: __init__() takes at most 2 arguments (3 given)
>
> Any ideas? I'm not too sure what's going on here.
>
> >


--~--~-~--~~~---~--~~
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 group, send email to 
sqlalchemy+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~--~~~~--~~--~--~---