{"id":15561306,"url":"https://github.com/bobbui/cassandra-cql-exporter","last_synced_at":"2025-11-05T19:01:33.224Z","repository":{"id":49965604,"uuid":"60340418","full_name":"bobbui/cassandra-CQL-exporter","owner":"bobbui","description":"A highly configurable utility to export whole Apache Cassandra keyspace or table structure/data to CQL scripts.","archived":false,"fork":false,"pushed_at":"2023-12-05T22:07:43.000Z","size":4971,"stargazers_count":19,"open_issues_count":2,"forks_count":8,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-01-13T09:43:50.422Z","etag":null,"topics":["backup-database","backup-script","cassandra","cql","cql-scripts","ddl","java","keyspace","restore","restore-database"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bobbui.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-06-03T10:39:15.000Z","updated_at":"2022-09-07T18:36:36.000Z","dependencies_parsed_at":"2024-10-28T11:26:30.459Z","dependency_job_id":null,"html_url":"https://github.com/bobbui/cassandra-CQL-exporter","commit_stats":{"total_commits":3,"total_committers":3,"mean_commits":1.0,"dds":0.6666666666666667,"last_synced_commit":"3719ef2376b6db1bd242913538ad2523edf2d202"},"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bobbui%2Fcassandra-CQL-exporter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bobbui%2Fcassandra-CQL-exporter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bobbui%2Fcassandra-CQL-exporter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bobbui%2Fcassandra-CQL-exporter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bobbui","download_url":"https://codeload.github.com/bobbui/cassandra-CQL-exporter/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":235621551,"owners_count":19019519,"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":["backup-database","backup-script","cassandra","cql","cql-scripts","ddl","java","keyspace","restore","restore-database"],"created_at":"2024-10-02T16:07:21.757Z","updated_at":"2025-10-07T11:30:25.381Z","avatar_url":"https://github.com/bobbui.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"## Summary\nAn alternative utility to **nodetool snapshot**  to export whole [Apache Cassandra](http://cassandra.apache.org/) keyspace/table structure and data to Cassandra Query Language (CQL) scripts. CQL scripts is a lightweight,simple way to restore and backup databases.\n\nFeatures:\n-  simple and configurable, see usage for detail.\n-  fast and highly scalable: Data is exported gradually, so memory usage is very low, e.g: for my keyspace with 1,5 million record took ~3m to generated.\n-  export process is tracked with detail information.\n-  CQL scripts is ready to import using [SOURCE command](http://docs.datastax.com/en/cql/3.3/cql/cql_reference/source_r.html).\n-  tested with Cassandra \u003e 2.1, 2.2, 3.0 and tick-tock releases.\n-  require Java \u003e 6., make sure Java is available in PATH variable.\n\nOvercome nodetool snapshot caveats:\n-  snapshot can only be restored when table schema is there --\u003e **cassandra-CQL-exporter** support both DDL and DML backup.\n-  snapshot can only run on a node, multiple node require parallel ssh to be setup --\u003e  **cassandra-CQL-exporter** dont need to care there is how many node.\n-  snapshot is stored the node itself, **cassandra-CQL-exporter** back up is stored on the backup client itself --\u003e more isolated backup environment.\n\nGenerated script contains 2 component:\n- DDL: include keyspace CREATE statement, all tables, indexs, materialized views, function, aggregate function, user defined type.\n- DML: INSERT statement for tables data.\n\nBe careful that script will be forward-compatible but not guarantee to be backward-compatible especially DDL statements. It's better that export and import using same Cassandra version.\nI'm using this on a daily basis. But anyways, use this at **YOUR OWN RISK**!\n\n## Usage\n```\nusage: cql-export [--drop] [-f \u003cfile name\u003e] [-fo] [-h \u003chost\u003e] [--help] [-k \u003ckeyspace\u003e] [-l] [-m]\n       [--noddl] [--nodml] [-p \u003cpassword\u003e] [-po \u003cport\u003e] [-s] [-t \u003ctable\u003e] [--test] [--truncate] [-u\n       \u003cusername\u003e] [-v] [--secure]\n    --drop                  add DROP KEYSPACE statement. BE CAREFUL! THIS WILL WIPED OUT ENTIRE\n                            KEYSPACE\n -f,--file \u003cfile name\u003e      exported file path. default to \"\u003ckeyspace\u003e.CQL\" or\n                            \"\u003ckeyspace\u003e.\u003ctable\u003e.CQL\"\n -fo,--force                force overwrite of existing file\n -h,--host \u003chost\u003e           server host name or IP of database server, default is \"localhost\"\n    --help                  print this help message\n -k,--keyspace \u003ckeyspace\u003e   database keyspace to be exported. \n  or  \u003ckeyspace1,keyspace2\u003e It allows to specify multiple keyspaces separated with comma. e.g. -k keyspace1,keyspace2\n -kf,--keyspacesFile        Allows to specify file which contains keyspaces you'd like to export, separated by new line                   \n -l,--license               Print this software license\n -m,--merge                 merge table data, insert will be generated with \"IF NOT EXISTS\"\n    --noddl                 don't generate DDL statements (CREATE TABLE, INDEX, MATERIALIZED VIEW,\n                            TYPE, TRIGGER, AGGREGATE), mutual exclusive with \"nodml\" option\n    --nodml                 don't generate DML statements (INSERT), mutual exclusive with \"noddl\"\n                            option\n -p,--pass \u003cpassword\u003e       database password\n -po,--port \u003cport\u003e          database server port, default is 9042\n -s,--separate              seperated export by tables\n -t,--table \u003ctable\u003e         keyspace table to be exported\n    --test                  Enable test mode. for development testing only\n    --truncate              add TRUNCATE TABLE statement. BE CAREFUL!\n -u,--user \u003cusername\u003e       database username\n -v,--verbose               print verbose message\n    --secure                connect via SSL, -Djavax.net.ssl.trustStore=... -Djavax.net.ssl.trustStorePassword=... \n                            must be added to JAVA_OPTS environment variable\n```\n\n##Sample usage\n\n1. Simplest usages; only keyspace needed with **localhost** server and default port\n\n        $cql-export -k cycling\n        Trying connect to host \"localhost\"\n        Success!\n        Trying connect to port \"9042\" \n        Success!\n        Trying connect to keyspace \"cycling\"\n        Success!\n        All good!\n        Start exporting...\n        Write DDL to C:\\cql-generator\\cycling.CQL\n        Extract from cycling.cyclist_races\n        Total number of record: 117920\n        Start write \"cyclist_teams\" data DML to C:\\cql-generator\\cycling.CQL\n        Done 5.00%\n        Done 30.00%\n        Done 90.00%\n        Done exporting \"cyclist_teams\", total number of records exported: 117920\n        Export completed after 21.179 s!\n        Exited.\n\n2. Simple usage:\n```\n$cql-export -h localhost-po 9043 -k cycling\n```\n3. Generate only DDL statement \n```\n$cql-export -h localhost-po 9043  -k keyspace_name -noddl\n```\n## TODO\nTODO: optimized jar size.  \n## License\n Apache 2.0 License\n\n## Using gradle\n\n### Run\n```\n./gradlew \n```\nor (Windows:)\n```\ngradlew.bat\n```\n\n### Build jar file\n\n```\n./gradlew jar\n```\nor (Windows:)\n```\ngradlew.bat jar\n```\n\nthis places the jar file into the \"dist\" folder\n\n\n## Change log\nversion 1.1 with gradle script and possibility to specify multiple keyspaces to export \ncontributed by matto3c https://www.codegravity.com\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbobbui%2Fcassandra-cql-exporter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbobbui%2Fcassandra-cql-exporter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbobbui%2Fcassandra-cql-exporter/lists"}