couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Apache Wiki <wikidi...@apache.org>
Subject [Couchdb Wiki] Update of "DumpOracleDbToCouchDbPython" by DougShawhan
Date Sat, 14 Nov 2009 22:02:43 GMT
Dear Wiki user,

You have subscribed to a wiki page or wiki category on "Couchdb Wiki" for change notification.

The "DumpOracleDbToCouchDbPython" page has been changed by DougShawhan.
The comment on this change is: Need to actually spend some real time on this. Sorry..
http://wiki.apache.org/couchdb/DumpOracleDbToCouchDbPython?action=diff&rev1=5&rev2=6

--------------------------------------------------

      for table_name in table_names:
          gm.updateCouch( table_name )
  }}}
+ = Unique Values in SQL Table Converted to a Single Document =
+ Differs from above in that it places all table data into a single document.
  
- = Unique Values in SQL Table Converted to a Single Document =
+ {{{#!sql
  
- Differs from above in that 
+ select username, shoe_size, nostril_count, owns_weather_ballon from humans;
  
- This probably isn't what you want either!
+ username | shoe_size | nostril_count | owns_weather_balloon
+ 
+ cletus        | 10            | 3                    | y
+ }}}
+ becomes:
+ 
+ {{{#!python
+ 
+ db[ 'humans' ]{'username': 'cletus','shoe_size': 10,'nostril_count': 3,'owns_weather_balloon':
'y' }
+ }}}
+ This probably isn't what you want either! Script does no checking to make sure that your
particular value is unique.
  
  {{{#!python
  # HEY! THIS VERSION CAN MAKE A MOTHER-HUGE DOCUMENT! KNOW WHAT YOU ARE DOING!!!
@@ -128, +140 @@

  
          query = """
              select %s
-             from %s 
+             from %s
              order by %s"""""%( ", ".join( header ),
                                      self.table_name,
-                                     self.mykey ) 
+                                     self.mykey )
  
          cursor.execute( query )
          results = dict(
-                 [ ( str( row[0] ), dict( 
+                 [ ( str( row[0] ), dict(
-                     [ (k, v) for k, v in zip( header, row ) ] 
+                     [ (k, v) for k, v in zip( header, row ) ]
-                     ) ) for row in cursor.fetchall() 
+                     ) ) for row in cursor.fetchall()
                  ] )
  
          # clean up any datetime fields

Mime
View raw message