Re: Extracting DB schema (newbie Q)

2012-05-17 Thread Steve Sawyer
Thanks, James, but John Gordon identified my usage error so I'm good to go now. On Mon, 14 May 2012 09:28:06 -0700 (PDT), james hedley jameskhed...@gmail.com wrote: On Monday, 14 May 2012 17:01:49 UTC+1, Steve Sawyer wrote: Brand-new to Python (that's a warning, folks) Trying to write a

Extracting DB schema (newbie Q)

2012-05-14 Thread Steve Sawyer
Brand-new to Python (that's a warning, folks) Trying to write a routine to import a CSV file into a SQL Server table. To ensure that I convert the data from the CSV appropriately, Im executing a query that gives me the schema (data column names, data types and sizes) from the target table. What

Re: Extracting DB schema (newbie Q)

2012-05-14 Thread Chris Angelico
On Tue, May 15, 2012 at 2:01 AM, Steve Sawyer ssaw...@stephensawyer.com wrote: Brand-new to Python (that's a warning, folks) It's one we're familiar with :) Welcome! Trying to write a routine to import a CSV file into a SQL Server table. To ensure that I convert the data from the CSV

Re: Extracting DB schema (newbie Q)

2012-05-14 Thread Jean-Michel Pichavant
Steve Sawyer wrote: Brand-new to Python (that's a warning, folks) Trying to write a routine to import a CSV file into a SQL Server table. To ensure that I convert the data from the CSV appropriately, Im executing a query that gives me the schema (data column names, data types and sizes) from

Re: Extracting DB schema (newbie Q)

2012-05-14 Thread John Gordon
In bca2r7dt23l49ovp7m7id1ap3iaccvk...@4ax.com Steve Sawyer ssaw...@stephensawyer.com writes: What I think I want to do is to construct a dictionary using the column names as the index value, and a list containing the various attributes (data type, lenghth, precision). If you're using just

Re: Extracting DB schema (newbie Q)

2012-05-14 Thread Steve Sawyer
Thanks, John. What are you trying that isn't working? Typical newbie trick - trying to make things more complicated than they are. I didn't realize that syntax would establish the key/value pairs of the dictionary - I thought that would only allow you to establish the value to correspond to a

Re: Extracting DB schema (newbie Q)

2012-05-14 Thread Chris Angelico
On Tue, May 15, 2012 at 5:09 AM, Steve Sawyer ssaw...@stephensawyer.com wrote: Thanks - now, given my query that returns the table structure, this works fine: table_dict = {} table_specs = cursor.execute(query_string) for row in table_specs:        row_dict = {}        row_dict['type'] =

Re: Extracting DB schema (newbie Q)

2012-05-14 Thread james hedley
On Monday, 14 May 2012 17:01:49 UTC+1, Steve Sawyer wrote: Brand-new to Python (that's a warning, folks) Trying to write a routine to import a CSV file into a SQL Server table. To ensure that I convert the data from the CSV appropriately, Im executing a query that gives me the schema (data