C3 / activerecord-jdbcteradata-adapter

MIT License
2 stars 0 forks source link

Not Compatible With ActiveRecord 3.2.1? #1

Open RobGoretsky opened 12 years ago

RobGoretsky commented 12 years ago

Hello, First off, I wanted to thank you for releasing your ActiveRecord JDBC Teradata adapter as open source. It's going to be a huge help to have this as a starting point!

I was just wondering if you had worked on this at all during the past year, and tried it with recent versions of ActiveRecord. If you haven't, do you know if any other users have forked and/or continued development on this? If not, I'd be happy to try to lend a hand. Also, do you know what the latest compatible AR version for this would be?

I ask beacuse I just tried gem installing the "c3-activerecord-jdbc-adapter" (version 1.1.3.1), and then just trying to create a basic model for a Teradata table. When I do something like

Orders.first

I get the following error: ArgumentError: wrong number of arguments (3 for 2) find_by_sql at /data/home/mlbetl/jruby/jruby-1.6.7/lib/ruby/gems/1.8/gems/activerecord-3.2.1/lib/active_record/querying.rb:38 logging_query_plan at /data/home/mlbetl/jruby/jruby-1.6.7/lib/ruby/gems/1.8/gems/activerecord-3.2.1/lib/active_record/explain.rb:25 find_by_sql at /data/home/mlbetl/jruby/jruby-1.6.7/lib/ruby/gems/1.8/gems/activerecord-3.2.1/lib/active_record/querying.rb:37 exec_queries at /data/home/mlbetl/jruby/jruby-1.6.7/lib/ruby/gems/1.8/gems/activerecord-3.2.1/lib/active_record/relation.rb:170

I don't get this error when I use ActiveRecord 3.0.9. I get a different error for AR 3.0.9, but one that at least seems to be more directly related to the ARJDBC-Teradata code.. Any information you can provide on what AR versions work well with this Teradata JDBC adapter would be greatly appreciated!

tism commented 12 years ago

When it was written the project it was for was still using 2.3.x and it hasn't really been touched since then. It was initially a proof of concept and isn't feature complete (most of it worked but it wasn't really exercised that well). It hasn't gone much further since then as the need for Teradata support disappeared.

tism commented 12 years ago

I've gone back and looked at this stuff again and this repo is a bit of a red herring. I think I started it to mimic the other jdbc providing gems but it doesn't work too well as I couldn't package the jars for it as part of the gem. The code you're interested in is over on a feature branch on the activerecord-jdbc-adapter repo, https://github.com/C3/activerecord-jdbc-adapter/tree/1-1-stable-teradata. There's also a teradata branch which should contain the same commits but 1-1-stable-teradata was a rebased against 1-1-stable from upstream. The project requiring teradata support had an initializer to require the jdbc jars and a referenced to c3-activerecord-jdbc-adapter in the bundle.

RobGoretsky commented 12 years ago

Hey Lucas, Thanks so much for responding! I figured that this repository was actually incomplete (and that I needed to look at the 1.1-stable-teradata branch in the other repository to get the remainder of the code). Good to know that the last AR version you tested with was 2.3.x - I'm going to try to see if I can get your code working with that version of AR on my side. I was really just hoping to use it as a jumping off point, so maybe I'll fork and work from that 1.1-stable-teradata branch if I get the chance.

For now, I'm just using the generic JDBC ActiveRecord adapter, but it seems to have a lot of compatibility issues with Teradata - for example, the "LIMIT" clause that is automatically inserted when you do something like 'Orders.first' is not compatible with Teradata. I see you had started working on something to resolve that by replacing the limit/offset clause. Was that piece working well with your code?

tism commented 12 years ago

I'm pretty sure that the offset/limit worked ok, it should support most of the general use cases fine. If you're well versed in Teradata I'd double check the code isn't doing something silly when it generates the subselect.