{"id":1299,"date":"2016-11-03T21:06:15","date_gmt":"2016-11-03T21:06:15","guid":{"rendered":"http:\/\/62.131.51.129\/?p=1299"},"modified":"2016-11-03T21:06:15","modified_gmt":"2016-11-03T21:06:15","slug":"read-and-write-by-python","status":"publish","type":"post","link":"http:\/\/archief.van-maanen.com\/?p=1299","title":{"rendered":"Read and write by Python"},"content":{"rendered":"<p>Python seems to be a very convenient way to transfer data to and fro Oracle. It has capabilities to set up a connection and it seems quite capable to transfer a matrix into a table and vice versa. Next code shows this. It first retrieves the content of a table. In a second step some data from a matrix are stored into a table.<\/p>\n<pre>\nimport cx_Oracle\ncon = cx_Oracle.connect('scott\/bunvogni@van-maanen.com\/orcl')\ncur = con.cursor()\ncur.execute('select * from departments order by department_id')\nres = cur.fetchall()\nprint res\nrows = [ (1, \"First\" ),\n         (2, \"Second\" ),\n         (3, \"Third\" ),\n         (4, \"Fourth\" ),\n         (5, \"Fifth\" ),\n         (6, \"Sixth\" ),\n         (7, \"Seventh\" ) ]\ncur = con.cursor()\ncur.setinputsizes(int, 20)\ncur.executemany(\"insert into mytable(id, data) values (:1, :2)\", rows)\ncon.commit()\ncon.close()\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Python seems to be a very convenient way to transfer data to and fro Oracle. It has capabilities to set up a connection and it seems quite capable to transfer a matrix into a table and vice versa. Next code shows this. It first retrieves the content of a table. In a second step some [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":1303,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-1299","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-uncategorized"],"_links":{"self":[{"href":"http:\/\/archief.van-maanen.com\/index.php?rest_route=\/wp\/v2\/posts\/1299","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/archief.van-maanen.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/archief.van-maanen.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/archief.van-maanen.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/archief.van-maanen.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1299"}],"version-history":[{"count":0,"href":"http:\/\/archief.van-maanen.com\/index.php?rest_route=\/wp\/v2\/posts\/1299\/revisions"}],"wp:attachment":[{"href":"http:\/\/archief.van-maanen.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1299"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/archief.van-maanen.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1299"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/archief.van-maanen.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1299"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}