{"id":23450805,"url":"https://github.com/red-data-tools/red-arrow-duckdb","last_synced_at":"2025-04-13T20:14:51.739Z","repository":{"id":56891382,"uuid":"394863820","full_name":"red-data-tools/red-arrow-duckdb","owner":"red-data-tools","description":"A library that provides Apache Arrow support to ruby-duckdb","archived":false,"fork":false,"pushed_at":"2024-10-10T21:02:08.000Z","size":39,"stargazers_count":11,"open_issues_count":0,"forks_count":4,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-04-13T20:14:39.921Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/red-data-tools.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}},"created_at":"2021-08-11T04:39:18.000Z","updated_at":"2025-04-08T00:41:56.000Z","dependencies_parsed_at":"2022-08-21T00:20:48.407Z","dependency_job_id":null,"html_url":"https://github.com/red-data-tools/red-arrow-duckdb","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/red-data-tools%2Fred-arrow-duckdb","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/red-data-tools%2Fred-arrow-duckdb/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/red-data-tools%2Fred-arrow-duckdb/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/red-data-tools%2Fred-arrow-duckdb/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/red-data-tools","download_url":"https://codeload.github.com/red-data-tools/red-arrow-duckdb/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248774968,"owners_count":21159534,"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":[],"created_at":"2024-12-24T00:15:11.341Z","updated_at":"2025-04-13T20:14:51.725Z","avatar_url":"https://github.com/red-data-tools.png","language":"C++","funding_links":[],"categories":["C++"],"sub_categories":[],"readme":"# README\n\n## Name\n\nRed Arrow DuckDB\n\n## Description\n\nRed Arrow DuckDB is a library that provides Apache Arrow support to ruby-duckdb.\n\n## Install\n\n```bash\ngem install red-arrow-duckdb\n```\n\n## Usage\n\n### Receive result as Apache Arrow data\n\n```ruby\nrequire \"arrow-duckdb\"\n\nDuckDB::Database.open do |db|\n  db.connect do |connection|\n    connection.query('CREATE TABLE users (id INTEGER, name VARCHAR(30))')\n\n    connection.query(\"INSERT into users VALUES(1, 'Alice')\")\n    connection.query(\"INSERT into users VALUES(2, 'Bob')\")\n    connection.query(\"INSERT into users VALUES(3, 'Cathy')\")\n\n    result = connection.query(\"SELECT * FROM users\", output: :arrow)\n    puts(result.to_table)\n    # \tid\tname\n    # 0\t 1\tAlice\n    # 1\t 2\tBob \n    # 2\t 3\tCathy\n  end\nend\n```\n\n### Use Apache Arrow data as input\n\n```ruby\nrequire \"arrow-duckdb\"\n\nusers = Arrow::Table.new(\"id\" =\u003e [1, 2, 3],\n                         \"name\" =\u003e [\"Alice\", \"Bob\", \"Cathy\"])\nDuckDB::Database.open do |db|\n  db.connect do |connection|\n    connection.register(\"users\", users) do\n      connection.query(\"SELECT * FROM users\").each do |row|\n        p row\n        # [\"1\", \"Alice\"]\n        # [\"2\", \"Bob\"]\n        # [\"3\", \"Cathy\"]\n      end\n    end\n  end\nend\n```\n\n### Filter Apache Arrow data by DuckDB\n\n```ruby\nrequire \"arrow-duckdb\"\n\nusers = Arrow::Table.new(\"id\" =\u003e [1, 2, 3],\n                         \"name\" =\u003e [\"Alice\", \"Bob\", \"Cathy\"])\nDuckDB::Database.open do |db|\n  db.connect do |connection|\n    filtered_users = connection.register(\"users\", users) do\n      result = connection.query(\"SELECT * FROM users WHERE id \u003e ?\",\n                                1,\n                                output: :arrow)\n      result.to_table\n    end\n    puts(filtered_users)\n    # \tid\tname\n    # 0\t 2\tBob \n    # 1\t 3\tCathy\n\n    # Use filtered data again\n    connection.register(\"filtered_users\", filtered_users) do\n      result = connection.query(\"SELECT * FROM filtered_users\",\n                                output: :arrow)\n      puts(result.to_table)\n      # \tid\tname\n      # 0\t 2\tBob \n      # 1\t 3\tCathy\n    end\n  end\nend\n```\n\n## Dependencies\n\n* [Red Arrow](https://github.com/apache/arrow/tree/master/ruby/red-arrow)\n\n* [ruby-duckdb](https://github.com/suketa/ruby-duckdb)\n\n## Authors\n\n* Sutou Kouhei \\\u003ckou@clear-code.com\\\u003e\n\n## License\n\nApache License 2.0. See doc/text/apache-2.0.txt for details.\n\n(Sutou Kouhei has a right to change the license including contributed\npatches.)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fred-data-tools%2Fred-arrow-duckdb","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fred-data-tools%2Fred-arrow-duckdb","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fred-data-tools%2Fred-arrow-duckdb/lists"}