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] Trivial Update of "DumpOracleDbToCouchDbPython" by DougShawhan
Date Fri, 13 Nov 2009 20:43:23 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.
http://wiki.apache.org/couchdb/DumpOracleDbToCouchDbPython?action=diff&rev1=1&rev2=2

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

  # indexed by, put them into the list of tuples below and let fly.
  # I store all my config stuf in an ini file locally.  you'll have to handle
  # your own connection to your db.
- # This is pretty quick-and-dirty and I don't reccomend it for any sort of 
+ # This is pretty quick-and-dirty and I don't reccomend it for any sort of
  # production anything at all! :-)
- # Should work for any db api 2 compliant sql datablase. Holler if I'm wrong
+ # Should work for any db api 2 compliant sql database.
  # Script guaranteed 100% slower than christmas.
  
  db_name = 'mydatabase'
@@ -71, +71 @@

  
          query = """
              select %s
-             from %s 
+             from %s
              where %s=:myunique"""""%( ", ".join( header ),
                                      self.table_name,
-                                     self.mykey ) 
+                                     self.mykey )
          cursor.prepare( query )
-         
+ 
          for myunique in [ { "myunique": i } for i in self.uniques() ]:
              cursor.execute( None, myunique )
              entry = dict( [ (k, v) for k, v in zip( header, cursor.fetchone() ) ] )
@@ -84, +84 @@

              # will probably need to convert to unix epochal time
              for k in entry:
                  if isinstance( entry[k], datetime.datetime ):
-                     entry[ k ] = "%s"%entry[ k ] 
+                     entry[ k ] = "%s"%entry[ k ]
  
              if not str( myunique[ 'myunique' ] ) in self.db:
                  self.db[ str( myunique[ 'myunique' ] ) ] = entry
@@ -100, +100 @@

      gm = GrabbyMitts( db_name )
      for table_name in table_names:
          gm.updateCouch( table_name )
- 
  }}}
  

Mime
View raw message