Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Python: Python
Extracting DB schema (newbie Q)
 

Index | Next | Previous | View Flat


ssawyer at stephensawyer

May 14, 2012, 9:01 AM


Views: 270
Permalink
Extracting DB schema (newbie Q)

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,
I"m executing a query that gives me the schema (data column names,
data types and sizes) from the target table.

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 this is NOT a good approach (or if there is a better approach),
please issue a dope-slap, ignore the rest of this post and set me
straight.

If this is a good approach, I ran into a problem populating the
dictionary as I couldn't seem to figure out how to make the update()
method work by passing the name property of the row object; I kept
getting a "keyword can't be an expression" error.

What I was able to make work was to construct the command as a string
and run exec(<python command>), but seems there shoudl be a more
direct way of updating the dictionary.

TIA.
--
http://mail.python.org/mailman/listinfo/python-list

Subject User Time
Extracting DB schema (newbie Q) ssawyer at stephensawyer May 14, 2012, 9:01 AM
    Re: Extracting DB schema (newbie Q) rosuav at gmail May 14, 2012, 9:11 AM
    Re: Extracting DB schema (newbie Q) jameskhedley at gmail May 14, 2012, 9:28 AM
    Re: Extracting DB schema (newbie Q) jeanmichel at sequans May 14, 2012, 9:36 AM
    Re: Extracting DB schema (newbie Q) gordon at panix May 14, 2012, 10:05 AM
        Re: Extracting DB schema (newbie Q) ssawyer at stephensawyer May 14, 2012, 12:09 PM
            Re: Extracting DB schema (newbie Q) rosuav at gmail May 14, 2012, 2:49 PM
    Re: Extracting DB schema (newbie Q) ssawyer at stephensawyer May 17, 2012, 9:01 AM

  Index | Next | Previous | View Flat
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.