consultingmd / activerecord5-redshift-adapter Goto Github PK
View Code? Open in Web Editor NEWLicense: Other
License: Other
I'm using this gem with Ruby class(without Rails)
When I create a new record, it doesn't fetch the id of the newly created record. It fetches all other fields like created_at and updated_at.
It would be really helpful if you do any patch for this fix
Hi,
https://rubygems.org/gems/rails/versions/6.0.0 is out and i was wondering if this library should support it ?
Regards
A similar issue can be found in the activerecord4 adapter: aamine/activerecord4-redshift-adapter#25 and there's an open PR to fix it: aamine/activerecord4-redshift-adapter#26.
However, this error only propped up in my app after the rails 5 upgrade and the switch to this gem. Full Backtrace:
PG::SyntaxError: ERROR: syntax error at or near "DISCARD"
LINE 1: DISCARD ALL
^
1
File "/usr/local/bundle/gems/activerecord5-redshift-adapter-0.0.1/lib/active_record/connection_adapters/redshift_adapter.rb" line 238 in exec
2
File "/usr/local/bundle/gems/activerecord5-redshift-adapter-0.0.1/lib/active_record/connection_adapters/redshift_adapter.rb" line 238 in reset!
3
File "/usr/local/bundle/gems/activerecord-5.0.0.1/lib/active_record/connection_adapters/abstract/connection_pool.rb" line 565 in block (2 levels) in reap
4
File "/usr/local/lib/ruby/2.3.0/monitor.rb" line 214 in mon_synchronize
5
File "/usr/local/bundle/gems/activerecord-5.0.0.1/lib/active_record/connection_adapters/abstract/connection_pool.rb" line 563 in block in reap
6
File "/usr/local/bundle/gems/activerecord-5.0.0.1/lib/active_record/connection_adapters/abstract/connection_pool.rb" line 562 in each
7
File "/usr/local/bundle/gems/activerecord-5.0.0.1/lib/active_record/connection_adapters/abstract/connection_pool.rb" line 562 in reap
8
File "/usr/local/bundle/gems/activerecord-5.0.0.1/lib/active_record/connection_adapters/abstract/connection_pool.rb" line 708 in acquire_connection
9
File "/usr/local/bundle/gems/activerecord-5.0.0.1/lib/active_record/connection_adapters/abstract/connection_pool.rb" line 501 in checkout
10
File "/usr/local/bundle/gems/activerecord-5.0.0.1/lib/active_record/connection_adapters/abstract/connection_pool.rb" line 364 in connection
11
File "/usr/local/bundle/gems/activerecord-5.0.0.1/lib/active_record/connection_adapters/abstract/connection_pool.rb" line 875 in retrieve_connection
12
File "/usr/local/bundle/gems/activerecord-5.0.0.1/lib/active_record/connection_handling.rb" line 128 in retrieve_connection
13
File "/usr/local/bundle/gems/activerecord-5.0.0.1/lib/active_record/connection_handling.rb" line 91 in connection
Hi,
Thanks for making this adapter available.
I've been playing with it for a Rails 5.1 project, and had to patch a few methods to have it working (mainly method arity changes).
Would you accept PRs for Active Record 5.1 on this repo, or is it meant to only support AR 5.0?
Thanks!
Thomas.
Just receiving this warning from the PG connection with redshift:
The PGconn, PGresult, and PGError constants are deprecated, and will be
removed as of version 1.0.
You should use PG::Connection, PG::Result, and PG::Error instead, respectively.
Called from /usr/local/var/rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/activesupport-5.1.1/lib/active_support/dependencies.rb:258:in `load_dependency'
activerecord5-redshift-adapter (1.0.1)
activerecord (5.2.4.3)
In our table in redshift we have
Column | Type
member_id | integer
In the rails console we do
irb(main):004:0> RedshiftDB.connection.raw_connection.async_exec("select member_id from table_name where list_id = $1", [l.id]).column_values(0)
=> ["13615050"]
I would expect this to be an array of integers, not strings, given the type on the column.
Running the same query with a postgres adaptor in a postgres database returns an integer.
It's common to use text
in an AR migration to define a wide column that contains many characters. Redshift does not support a text
datatype, but it does support varchar up to 65535. Therefore, we should change the definition of text
in a migration to generate VARCHAR(65535) instead of VARCHAR(255), which what happens now and likely surprising behavior.
I'm up in the air if we want to throw some sort of warning about this. A 64k wide column probably isn't what you actually want, but you likely want something bigger than 255.
Rails 5.2.2
Activerecord 5.2.2
Ruby 2.5.1
Was working with activerecord4-redshift-adapter
. Thinking it's a config value issue, but not sure
ArgumentError: wrong number of arguments (given 3, expected 2)
/usr/local/bundle/gems/activerecord5-redshift-adapter-1.0.1/lib/active_record/connection_adapters/redshift/schema_definitions.rb:57:in `create_column_definition'
/usr/local/bundle/gems/activerecord-5.2.2/lib/active_record/connection_adapters/abstract/schema_definitions.rb:422:in `new_column_definition'
/usr/local/bundle/gems/activerecord-5.2.2/lib/active_record/connection_adapters/abstract/schema_definitions.rb:366:in `column'
/usr/local/bundle/gems/activerecord-5.2.2/lib/active_record/connection_adapters/abstract/schema_definitions.rb:232:in `block in string'
/usr/local/bundle/gems/activerecord-5.2.2/lib/active_record/connection_adapters/abstract/schema_definitions.rb:232:in `each'
/usr/local/bundle/gems/activerecord-5.2.2/lib/active_record/connection_adapters/abstract/schema_definitions.rb:232:in `string'
/usr/local/bundle/gems/activerecord-5.2.2/lib/active_record/internal_metadata.rb:37:in `block in create_table'
/usr/local/bundle/gems/activerecord-5.2.2/lib/active_record/connection_adapters/abstract/schema_statements.rb:305:in `create_table'
/usr/local/bundle/gems/activerecord-5.2.2/lib/active_record/internal_metadata.rb:36:in `create_table'
/usr/local/bundle/gems/activerecord-5.2.2/lib/active_record/migration.rb:1188:in `initialize'
/usr/local/bundle/gems/activerecord-5.2.2/lib/active_record/migration.rb:1036:in `new'
/usr/local/bundle/gems/activerecord-5.2.2/lib/active_record/migration.rb:1036:in `up'
/usr/local/bundle/gems/activerecord-5.2.2/lib/active_record/migration.rb:1011:in `migrate'
/usr/local/bundle/gems/activerecord-5.2.2/lib/active_record/tasks/database_tasks.rb:172:in `migrate'
/usr/local/bundle/gems/activerecord-5.2.2/lib/active_record/railties/databases.rake:60:in `block (2 levels) in <main>'
/usr/local/bundle/gems/secondbase-2.1.6/lib/second_base/databases.rake:37:in `block (4 levels) in <main>'
/usr/local/bundle/gems/secondbase-2.1.6/lib/second_base/on_base.rb:23:in `on_base'
/usr/local/bundle/gems/secondbase-2.1.6/lib/second_base/databases.rake:37:in `block (3 levels) in <main>'
/usr/local/bundle/gems/secondbase-2.1.6/lib/second_base/databases.rake:143:in `block (2 levels) in <main>'
I upgraded our application to Rails 5.2 and after deployment received a lot of PG::ConnectionBad: connection is closed
errors. I needed to restart the webserver and sidekiq to get rid of these errors, which fixed it for a couple of minutes. I wasn't able to reproduce it locally, and I am not sure how to fix it.
Do others have experienced similar problems? Does someone has an idea for a possible solution/ workaround?
Stacktrace:
/GEM_ROOT/gems/activerecord5-redshift-adapter-1.0.1/lib/active_record/connection_adapters/redshift/database_statements.rb:148 in async_exec
/GEM_ROOT/gems/activerecord5-redshift-adapter-1.0.1/lib/active_record/connection_adapters/redshift/database_statements.rb:148 in block in execute
/GEM_ROOT/gems/activerecord-5.2.0/lib/active_record/connection_adapters/abstract_adapter.rb:579 in block (2 levels) in log /home/deploy/.rvm/rubies/ruby-2.5.1/lib/ruby/2.5.0/monitor.rb:226 in mon_synchronize
/GEM_ROOT/gems/activerecord-5.2.0/lib/active_record/connection_adapters/abstract_adapter.rb:578 in block in log
/GEM_ROOT/gems/activesupport-5.2.0/lib/active_support/notifications/instrumenter.rb:23 in instrument
/GEM_ROOT/gems/activerecord-5.2.0/lib/active_record/connection_adapters/abstract_adapter.rb:569 in log
/GEM_ROOT/gems/activerecord5-redshift-adapter-1.0.1/lib/active_record/connection_adapters/redshift/database_statements.rb:147 in execute
Hi,
I'm trying to use the gem as a standalone script with Active Record. I need to require the gem but I cannot find the name for it:
irb(main):002:0> require 'activerecord-redshift-adapter'
LoadError: cannot load such file -- activerecord-redshift-adapter
from /usr/local/var/rbenv/versions/2.4.0/lib/ruby/2.4.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /usr/local/var/rbenv/versions/2.4.0/lib/ruby/2.4.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from (irb):2
from /usr/local/var/rbenv/versions/2.4.0/bin/irb:11:in `<main>'
irb(main):003:0>
#What is the name for require?
After updating to Rails 5.2.0, we began to see this error:
NoMethodError: undefined method `binds_from_relation' for #<ActiveRecord::ConnectionAdapters::RedshiftAdapter:0x0000000002e678a8>
/usr/local/lib/rvm/gems/ruby-2.4.2/bundler/gems/activerecord5-redshift-adapter-4d0303a77298/lib/active_record/connection_adapters/redshift/database_statements.rb:48:in `select_value'
/usr/local/lib/rvm/gems/ruby-2.4.2/bundler/gems/activerecord5-redshift-adapter-4d0303a77298/lib/active_record/connection_adapters/redshift/schema_statements.rb:99:in `data_source_exists?'
binds_from_relation is a private method in this module: https://github.com/rails/rails/blob/b7b0e5c1fd0ebb73b3fde5b2c059bcfd63aa07c4/activerecord/lib/active_record/connection_adapters/abstract/database_statements.rb#L391
This private method was removed
Hi ,
rails 5.2.0
ruby 2.5.1p57
I ma trying but getting this error , can anyone help me please ?
NameError (uninitialized constant ActiveRecord::ConnectionAdapters::RedshiftAdapter::PGconn)
And do you know what we'd need to change to make it work for 5.1? Would be happy to make a PR if you gave us suggestions.
-Teresa & https://github.com/FeminismIsAwesome
Hi, I'd like to make a small addition to activerecord5-redshift-adapter so I'm trying to get the tests to pass, but I'm having trouble just getting them to run. How do you set up a development environment?
Thanks!
Hi,
Im upgrading from Rails 4.2 to Raisl 5.2.1
So I must change activerecord4-redshift-adapter to activerecord5-redshift-adapter too.
When I start server rails s
, it through out errors
rgumentError - wrong number of arguments (given 2, expected 0..1):
activerecord (5.2.1) lib/active_record/errors.rb:100:in `initialize'
activerecord5-redshift-adapter (1.0.1) lib/active_record/connection_adapters/redshift_adapter.rb:569:in `new'
activerecord5-redshift-adapter (1.0.1) lib/active_record/connection_adapters/redshift_adapter.rb:569:in `rescue in connect'
activerecord5-redshift-adapter (1.0.1) lib/active_record/connection_adapters/redshift_adapter.rb:564:in `connect'
activerecord5-redshift-adapter (1.0.1) lib/active_record/connection_adapters/redshift_adapter.rb:198:in `initialize'
activerecord5-redshift-adapter (1.0.1) lib/active_record/connection_adapters/redshift_adapter.rb:42:in `new'
activerecord5-redshift-adapter (1.0.1) lib/active_record/connection_adapters/redshift_adapter.rb:42:in `redshift_connection'
activerecord (5.2.1) lib/active_record/connection_adapters/abstract/connection_pool.rb:809:in `new_connection'
activerecord (5.2.1) lib/active_record/connection_adapters/abstract/connection_pool.rb:853:in `checkout_new_connection'
activerecord (5.2.1) lib/active_record/connection_adapters/abstract/connection_pool.rb:832:in `try_to_checkout_new_connection'
activerecord (5.2.1) lib/active_record/connection_adapters/abstract/connection_pool.rb:793:in `acquire_connection'
activerecord (5.2.1) lib/active_record/connection_adapters/abstract/connection_pool.rb:521:in `checkout'
activerecord (5.2.1) lib/active_record/connection_adapters/abstract/connection_pool.rb:380:in `connection'
activerecord (5.2.1) lib/active_record/connection_adapters/abstract/connection_pool.rb:1008:in `retrieve_connection'
activerecord (5.2.1) lib/active_record/connection_handling.rb:118:in `retrieve_connection'
activerecord (5.2.1) lib/active_record/connection_handling.rb:90:in `connection'
activerecord (5.2.1) lib/active_record/migration.rb:554:in `call'
actionpack (5.2.1) lib/action_dispatch/middleware/callbacks.rb:28:in `block in call'
activesupport (5.2.1) lib/active_support/callbacks.rb:98:in `run_callbacks'
actionpack (5.2.1) lib/action_dispatch/middleware/callbacks.rb:26:in `call'
actionpack (5.2.1) lib/action_dispatch/middleware/executor.rb:14:in `call'
better_errors (1.1.0) lib/better_errors/middleware.rb:84:in `protected_app_call'
better_errors (1.1.0) lib/better_errors/middleware.rb:79:in `better_errors_call'
better_errors (1.1.0) lib/better_errors/middleware.rb:56:in `call'
actionpack (5.2.1) lib/action_dispatch/middleware/debug_exceptions.rb:61:in `call'
web-console (3.7.0) lib/web_console/middleware.rb:135:in `call_app'
web-console (3.7.0) lib/web_console/middleware.rb:30:in `block in call'
web-console (3.7.0) lib/web_console/middleware.rb:20:in `catch'
web-console (3.7.0) lib/web_console/middleware.rb:20:in `call'
actionpack (5.2.1) lib/action_dispatch/middleware/show_exceptions.rb:33:in `call'
railties (5.2.1) lib/rails/rack/logger.rb:38:in `call_app'
railties (5.2.1) lib/rails/rack/logger.rb:26:in `block in call'
activesupport (5.2.1) lib/active_support/tagged_logging.rb:71:in `block in tagged'
activesupport (5.2.1) lib/active_support/tagged_logging.rb:28:in `tagged'
activesupport (5.2.1) lib/active_support/tagged_logging.rb:71:in `tagged'
railties (5.2.1) lib/rails/rack/logger.rb:26:in `call'
actionpack (5.2.1) lib/action_dispatch/middleware/remote_ip.rb:81:in `call'
request_store (1.4.1) lib/request_store/middleware.rb:19:in `call'
actionpack (5.2.1) lib/action_dispatch/middleware/request_id.rb:27:in `call'
rack (2.0.5) lib/rack/method_override.rb:22:in `call'
rack (2.0.5) lib/rack/runtime.rb:22:in `call'
activesupport (5.2.1) lib/active_support/cache/strategy/local_cache_middleware.rb:29:in `call'
actionpack (5.2.1) lib/action_dispatch/middleware/executor.rb:14:in `call'
actionpack (5.2.1) lib/action_dispatch/middleware/static.rb:127:in `call'
rack (2.0.5) lib/rack/sendfile.rb:111:in `call'
rack (2.0.5) lib/rack/deflater.rb:34:in `call'
railties (5.2.1) lib/rails/engine.rb:524:in `call'
rack-rewrite (1.5.1) lib/rack/rewrite.rb:24:in `call'
puma (3.8.2) lib/puma/configuration.rb:224:in `call'
puma (3.8.2) lib/puma/server.rb:600:in `handle_request'
puma (3.8.2) lib/puma/server.rb:435:in `process_client'
puma (3.8.2) lib/puma/server.rb:299:in `block in run'
puma (3.8.2) lib/puma/thread_pool.rb:120:in `block in spawn_thread'
Do others have experienced similar problems? Does someone has an idea for a possible solution/ workaround?
I must be missing something simple. When i try to get gat via a model I'm getting
NameError (uninitialized constant ActiveRecord::ConnectionAdapters::RedshiftAdapter::PGconn):
rails 5.1.6
pg (1.0.0)
activerecord5-redshift-adapter (1.0)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.