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=9&rev2=10

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

+ = Dump an Oracle Table to CouchDB using Python =
+ Since CouchDB requires unique keys to access documents, importing data from 
an SQL database is an incitement to deep thought. 
+ 
+ If you went to the trouble of creating a single unique key in your SQL 
database, you may be inclined to use it as your couchdb _id. Hard to go wrong 
there. However, for certain groups of documents (say a collection of blog 
posts), simply using a iso format date as your _id is pretty handy and can 
greatly simplify writing views in both Javascript and Python.
+ 
+ The first two examples expect a unique key to be extracted from the SQL 
database, the third example lets CouchDB create the unique key. Of the three, 
the first and last are the most useful. The second example is for static or 
"throwaway tables" that have very few values, but might be a pain to just 
hand-copy (ex. config data).
+ 
+ You'll need the python couchdb module from 
http://code.google.com/p/couchdb-python/ , plus whatever DBAPI2.0 compliant 
module you use to connect to your favorite SQL database. These examples use 
Oracle, but it should be trivial to convert.
+ 
- = Unique Values in SQL Table Converted to Individual Documents =
+ == Unique Values in SQL Table Converted to Individual Documents ==
  Cro-Magnon simple python script which will take the contents of an SQL table 
and place it into CouchDB.
  
  This particular example depends on the SQL table having one unique field. The 
values in the unique field become individual documents in the CouchDB database.
- 
- You'll need the python couchdb module from 
http://code.google.com/p/couchdb-python/ , plus whatever DBAPI2.0 compliant 
module you use to connect to your favorite SQL database.This example uses 
Oracle, but it should be trivial to convert.
  
  This is probably not what you want. :-)
  
@@ -104, +111 @@

      for table_name in table_names:
          gm.updateCouch( table_name )
  }}}
- = Unique Values in SQL Table Converted to a Single Document =
+ == Unique Values in SQL Table Converted to a Single Document ==
  Differs from above in that it places all table data into a single document.
  
  {{{#!sql
@@ -162, +169 @@

          cursor.close()
  }}}
  
- = All Values from SQL Table Imported, Let CouchDB Assign Keys =
+ == All Values from SQL Table Imported, Let CouchDB Assign Keys ==
  
  This is most likely what you want!
  

Reply via email to