{"id":26293744,"url":"https://github.com/veksh/q_unload","last_synced_at":"2025-05-08T20:55:16.425Z","repository":{"id":211299858,"uuid":"80554015","full_name":"veksh/q_unload","owner":"veksh","description":"dump oracle SQL query result to CSV, fast","archived":false,"fork":false,"pushed_at":"2021-09-21T10:34:21.000Z","size":65,"stargazers_count":10,"open_issues_count":0,"forks_count":4,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-31T18:08:18.119Z","etag":null,"topics":["csv","export","oracle"],"latest_commit_sha":null,"homepage":null,"language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/veksh.png","metadata":{"files":{"readme":"Readme.markdown","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2017-01-31T19:29:32.000Z","updated_at":"2022-04-20T18:53:15.000Z","dependencies_parsed_at":"2023-12-07T18:00:25.990Z","dependency_job_id":null,"html_url":"https://github.com/veksh/q_unload","commit_stats":null,"previous_names":["veksh/q_unload"],"tags_count":25,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/veksh%2Fq_unload","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/veksh%2Fq_unload/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/veksh%2Fq_unload/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/veksh%2Fq_unload/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/veksh","download_url":"https://codeload.github.com/veksh/q_unload/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253149386,"owners_count":21861717,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["csv","export","oracle"],"created_at":"2025-03-15T02:30:16.039Z","updated_at":"2025-05-08T20:55:16.371Z","avatar_url":"https://github.com/veksh.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Description\n\nSimple program to dump query results to text files, based on some fork of Tom Kyte \noriginal [array-flat][kyte-flat] utility. Usually runs 10 times faster than dumping\nCSV with hand-crafted query from sql*plus, upto 100 times faster in extreme cases\nlike unloading large XML CLOBs in UTF8.\n\n[kyte-flat]: https://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:459020243348\n\n# Changes and added features\n- Makefile to automate build, fixes for current Oracle version (tested on 11.2)\n- user password is not printed to stderr\n- options for \n    - null replacement string\n    - newline replacement char\n    - forced cursor sharing\n- ablity to change fields separator\n- optionally enclosing strings and escaping delimitier inside strings\n- reading query from file\n- setting dbms_application_info for long-running queries\n- ability to work with CLOB fields with configurable maximum size (default 65K)\n\n# Usage\n- basic\n\n        ./q2csv userid=user/$pass@server sqlstmt='select * from gestori.katalog where rownum \u003c 10'  \n        ./q2csv userid=user/$pass@server sqlfile=query.sql enclosure='\"' replace_nl=' ' share=y \u003e t.dat\n        ./q2csv userid=user/$pass@server sqlfile=query.sql enclosure='\"' encl_esc='\"' \\\n           cli_info='uid=\"batch\", host=\"here\"' \\ \n           mod_info='ges SPb, proc=\"load-table-mail\"' \\\n           act_info='get-prog ora-ges.p'\n\n- options\n    - `userid`: credentials in `user/pass` format; pass with env var\n    - `sqlstmt`: query to execute (for inline)\n    - `sqlfile`: query file name (for saved)\n    - `delimiter`: field separator, default \"|\"\n    - `enclosure`: enclosing quotes for string fields, default: none\n    - `encl_esc`: escape char for enclosing quotes inside string fields, default: none\n    - `replace_null`: null replacement string, default \"?\"\n    - `null_string`: empty (null) string replacement, default \"\" (empty)\n    - `replace_nl`: newline replacement char, default: keep newlines\n    - `share`: if not empty, enable forced cursor sharing for session\n    - `arraysize`: fetch array size, default 10 records; set to 2-3 with large CLOBs\n    - `cli_info`, `mod_info`, `act_info`: client, module and action for `dbms_application_info`\n    - `max_clob`: maximum CLOB size, default 65K\n    - `headers`: if not empty, add field names as CSV header\n- obscure options, specific for our environment\n    - `pnull_string`: if string field equals hard-coded PRONULL string (currently \"\u003c$null4mail_ora$\u003e\"),\n      replace its contents with this string (usually \"?\") to facilitate Progress replication\n- to fine-tune date presentation: export env vars like\n\n        export NLS_LANG=AMERICAN_CIS.UTF8\n        export NLS_DATE_FORMAT='DD.MM.RR'\n        export NLS_TIMESTAMP_FORMAT='YYYY-MM-DD\"T\"HH24:MI:SS.FF6'\n\n- to prevent an application from hanging on SIGABRT (e.g. glibc \"double free\") errors: disable\n  [OCI signal handler][oci-faults] in `$TNS_ADMIN/sqlnet.ora`\n\n        DIAG_SIGHANDLER_ENABLED=FALSE\n\n[oci-faults]: https://docs.oracle.com/cd/E18283_01/appdev.112/e10646/oci10new.htm#CHDCIAHJ\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fveksh%2Fq_unload","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fveksh%2Fq_unload","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fveksh%2Fq_unload/lists"}