abrandoned / activerecord-jdbcvertica-adapter

MIT License
3 stars 5 forks source link

Update for rails 5 and ARJDBC-adapter 51.2 #9

Closed mrdeadsake closed 4 years ago

mrdeadsake commented 5 years ago

With Rails 5, there was a significant change to https://github.com/jruby/activerecord-jdbc-adapter v51, which handles the the base abstract adapter for ARJDBC.

These changes are the first steps in getting the vertica implementation of the activerecord-jdbc-adapter for Rails 5.

I'll be the first to admit that my knowledge in this area is severely limited, but at least ballista can connect and run the vertica db now.

The code as is meets the bare minimum of functionality and i'd love to learn more about JDBC and activerecord and get this to a great code change instead of a functional one 😄

After testing this out in sand, turns out this is more along the lines of what we would call barely functional

mrdeadsake commented 5 years ago

related to issue: https://github.com/abrandoned/activerecord-jdbcvertica-adapter/issues/8

mrdeadsake commented 5 years ago

Previous Vertica AR4 output

::Dimensions::Budget.columns.first
#<ActiveRecord::ConnectionAdapters::VerticaColumn:0x2b4f1b37
 @cast_type=
  #<ActiveRecord::Type::Integer:0x5accbeae
   @limit=nil,
   @precision=nil,
   @range=-2147483648...2147483648,
   @scale=nil>,
 @default=nil,
 @default_function=nil,
 @name="id",
 @null="f",
 @sql_type="int">

With AR5:

::Dimensions::Budget.columns.first
#<ActiveRecord::ConnectionAdapters::VerticaColumn:0x7d98e410
 @collation=nil,
 @comment=nil,
 @default=nil,
 @default_function=nil,
 @name="id",
 @null=false,
 @sql_type_metadata=
  #<ActiveRecord::ConnectionAdapters::SqlTypeMetadata:0x470d481
   @limit=nil,
   @precision=nil,
   @scale=nil,
   @sql_type="int",
   @type=:integer>,
 @table_name="budgets">

Comparison of Postgres columns for reference: AR4

::Dimensions::Budget.columns.first
#<ActiveRecord::ConnectionAdapters::PostgreSQLColumn:0x6dcdf58b
 @array=false,
 @cast_type=
  #<ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Integer:0x3b95678b
   @limit=8,
   @precision=nil,
   @range=-9223372036854775808...9223372036854775808,
   @scale=nil>,
 @default=nil,
 @default_function="nextval('budgets_id_seq'::regclass)",
 @name="id",
 @null=false,
 @oid=20,
 @sql_type="bigint">

AR5

::Dimensions::Budget.columns.first
#<ActiveRecord::ConnectionAdapters::PostgreSQLColumn:0x4a314ae4
 @collation=nil,
 @comment=nil,
 @default=nil,
 @default_function="nextval('budgets_id_seq'::regclass)",
 @max_identifier_length=63,
 @name="id",
 @null=false,
 @sql_type_metadata=
  #<ActiveRecord::ConnectionAdapters::SqlTypeMetadata:0x8381203
   @limit=8,
   @precision=nil,
   @scale=nil,
   @sql_type="bigint",
   @type=:integer>,
 @table_name="budgets">

Biggest differences are the use of the SqlTypeMetadata field, and there is no more use of the @cast_type which holds the range field.