Skip to content

Commit 8dbe618

Browse files
committed
Update README, improve description and setup documentation
1 parent 4423b2e commit 8dbe618

File tree

1 file changed

+64
-6
lines changed

1 file changed

+64
-6
lines changed

README.md

Lines changed: 64 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,12 @@
22

33
Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/activerecord/duckdb/adapter`. To experiment with that code, run `bin/console` for an interactive prompt.
44

5-
TODO: Delete this and the text above, and describe your gem
5+
6+
## Overview
7+
8+
DuckDB is an embeddable SQL OLAP database used analytical workloads, data science applications, and situations where you need fast analytical queries without the overhead of a separate database server. This adapter allows you to use DuckDB with ActiveRecord and Rails applications.
9+
10+
The adapter now defaults to **file-based databases** for data persistence, while still supporting in-memory databases as well.
611

712
## Installation
813

@@ -20,24 +25,77 @@ Or install it yourself as:
2025

2126
$ gem install activerecord-duckdb-adapter
2227

28+
## Dependencies
29+
30+
This adapter depends on:
31+
- [ruby-duckdb](https://github.com/suketa/ruby-duckdb) - Ruby bindings for DuckDB
32+
- ActiveRecord 7.0+
33+
2334
## Usage
2435

25-
TODO: Write usage instructions here
36+
### Basic Configuration
37+
38+
In your `database.yml`:
39+
40+
```yaml
41+
development:
42+
adapter: duckdb
43+
# File-based database (default)
44+
database: db/development.duckdb
45+
46+
# For in-memory database (useful for testing)
47+
# database: ":memory:"
48+
```
49+
50+
### Establishing Connection
51+
52+
```ruby
53+
ActiveRecord::Base.establish_connection(
54+
adapter: 'duckdb',
55+
database: 'db/my_app.duckdb' # or ':memory:' for in-memory database
56+
)
57+
```
58+
2659

2760
## Development
2861

29-
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
62+
After checking out the repo, run:
63+
64+
```bash
65+
bin/setup
66+
```
67+
68+
To run the test suite:
69+
70+
```bash
71+
bundle exec rake test
72+
```
73+
74+
75+
To experiment with the adapter:
76+
77+
```bash
78+
bin/console
79+
```
80+
81+
82+
83+
## References
84+
- [ruby-duckdb](https://github.com/suketa/ruby-duckdb): The underlying Ruby DuckDB driver (actively maintained)
85+
- [DuckDB Documentation](https://duckdb.org/docs/)
86+
- [ActiveRecord Adapter Development](https://web.archive.org/web/20230326213337/https://eng.localytics.com/odbc-and-writing-your-own-activerecord-adapter/)
87+
- [Rails Database Adapter Registration](https://github.com/rails/rails/commit/009c7e74117690f0dbe200188a929b345c9306c1)
88+
- [Arel Query Building](https://www.cloudbees.com/blog/creating-advanced-active-record-db-queries-arel)
3089

31-
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).
3290

3391
## Contributing
3492

35-
Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/activerecord-duckdb-adapter. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/[USERNAME]/activerecord-duckdb-adapter/blob/master/CODE_OF_CONDUCT.md).
93+
Bug reports and pull requests are welcome on GitHub at https://github.com/red-data-tools/activerecord-duckdb-adapter. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/[USERNAME]/activerecord-duckdb-adapter/blob/master/CODE_OF_CONDUCT.md).
3694

3795
## License
3896

3997
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
4098

4199
## Code of Conduct
42100

43-
Everyone interacting in the Activerecord::Duckdb::Adapter project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/activerecord-duckdb-adapter/blob/master/CODE_OF_CONDUCT.md).
101+
Everyone interacting in the Activerecord::Duckdb::Adapter project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/red-data-tools/activerecord-duckdb-adapter/blob/master/CODE_OF_CONDUCT.md).

0 commit comments

Comments
 (0)