Feature/add test suite#7
Open
eddietejeda wants to merge 3 commits intored-data-tools:mainfrom
Open
Conversation
- Update database_statements.rb transaction support and query execution, default to using @raw_connection, and add support for binding params - Add schema_statements.rb DDL operations (CREATE/ALTER/DROP table support) - BREAKING: Remove legacy Railtie approach and use modern ActiveRecord::ConnectionAdapters.register approach for registering gem - Add YARD documentation to make it clear which files were implementing necessary methods - Default to writing DuckDB file to disk - Validated lifecycle of creating and deploying databases and tested bundle exec rails db:drop db:create db:migrate db:seed db:reset - Use DuckDB's information_schema for accessing meta data - Default primary ids as bigints
- Add quoting.rb for proper SQL quoting and escaping - Add explain_pretty_printer.rb for formatted EXPLAIN output - Add tasks.rb for Rails database tasks (db:create, db:drop, etc.)
- Add test suite structured so that you can run bundle exec rake test - Add functional, integration, and unit tests with some tests stubbed out for future reference - Add CI workflow configuration for automated testing
nicosuave
pushed a commit
to nicosuave/activerecord-duckdb-adapter
that referenced
this pull request
Dec 5, 2025
### Summary of Changes
This pull request introduces support for the `time` data type when using
the SQLite backend. The ADBC SQLite driver does not natively support a
`time` type, so this change implements a workaround by quoting `Time`
objects as strings, which is consistent with how Rails' built-in SQLite3
adapter handles them.
The changes include:
- **Quoting:** A `quoted_time` method has been added to `quoting.rb`.
For the SQLite backend, it delegates to Rails' internal
`SQLite3::Quoting` module to ensure the time is formatted into the
standard `2000-01-01 HH:MM:SS.SSSSSS` string format.
- **Result Set Conversion:** The `Result` class in `result.rb` now
correctly converts these time strings back into an `Arrow::Time64Array`
when processing query results for a model.
- **Testing:** The `Time` type tests in `test_type.rb`, which were
previously omitted for SQLite, are now enabled and passing.
### Reason for Changes
Without this change, using `ActiveRecord::Type::Time` with the SQLite
backend would fail because the ADBC driver lacks native support for this
data type. This implementation bridges the gap by adopting the same
string-based serialization strategy used by the standard Rails SQLite3
adapter, enabling seamless use of the `time` type.
### Affected Components
- `lib/activerecord_adbc_adapter/quoting.rb`
- `lib/activerecord_adbc_adapter/result.rb`
- `test/test_type.rb`
### Testing
The existing tests for the `time` type in `test/test_type.rb` now run
successfully against the SQLite backend.
To verify:
1. Set the backend to SQLite.
2. Run the test suite, specifically `test_time_active_record` and
`test_time_arrow`.
```bash
bundle exec ruby test/run.rb -n /test_time/
```
All tests related to the Time type should pass.
### Related issue
red-data-tools#7
---------
Co-authored-by: Sutou Kouhei <kou@cozmixng.org>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add test suite and CI configuration