Code Monkey home page Code Monkey logo

activerecord5-redshift-adapter's People

Contributors

aamine avatar rapito avatar richddr avatar robdimarco avatar roryo avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

activerecord5-redshift-adapter's Issues

Deprecation for PGconn

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'

[FIXED] NoMethodError: undefined method `binds_from_relation'

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

Active Record 5.1 support

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.

"PG::ConnectionBad: connection is closed" on Rails 5.2

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

Connection#reset! throws an error

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

facing issue of PG.conn load error

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)

Integers being returned as strings

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.

Fetching Primary Key as nil after create

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

ArgumentError - wrong number of arguments (given 2, expected 0..1) on Rails 5.2.1

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?

'text' is not a valid data type with Redshift

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.

Cannot find the right name to load the gem

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?

ArgumentError: wrong number of arguments on Rails 5.2.2

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 &lt;main&gt;'
/usr/local/bundle/gems/secondbase-2.1.6/lib/second_base/databases.rake:37:in `block (4 levels) in &lt;main&gt;'
/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 &lt;main&gt;'
/usr/local/bundle/gems/secondbase-2.1.6/lib/second_base/databases.rake:143:in `block (2 levels) in &lt;main&gt;' 

how to run unit tests?

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!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.