Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
    Ken Collins
    @metaskills
    @jkoisch Thanks. From here I would focus on...
    Location.columns
    That will show the DB reflection AR column objects.
    I bet they would be different in each env.
    Which might come back to a perms issue with the user to connect to prod and/or how that DB or specific tables are setup with a certain user.
    John Koisch
    @jkoisch

    well, in the problem connection,

    Location.columns

    yields an empty array. Whereas in the working connection, it yields an array of columns w a lot of AR-specific information (as you would expect)

    but ... no error messages
    Ken Collins
    @metaskills
    OK, so that's the core problem.
    I suspect when schema reflection happens, the connecting DB user is not able to see the columns thru INFORMATION_SCHEMA.
    I suspect perm issues.
    You have to solve that.
    And everything will work.
    John Koisch
    @jkoisch
    as near as I can tell via roles and permissions, the dbUser has access to the Information_SCHEMA. Is there some way to check?
    Ken Collins
    @metaskills
    Not that I know of off hand. But I can say that is your issue.
    Dig a bit.
    John Koisch
    @jkoisch

    digging a lot ... through SMMS, this query returns 44 table names that are present in the dbo schema

    SELECT t.name
    FROM sys.tables AS t
    INNER JOIN sys.schemas AS s
    ON t.[schema_id] = s.[schema_id]
    WHERE s.name = N'dbo';

    this is true regardless of what database I hit (prod 1, prod2, dev 1, etc)

    when I run that from rails c, i get

    irb(main):006:0> results = Location.connection.exec_query("SELECT t.name FROM sys.tables AS t INNER JOIN sys.schemas AS s ON t.[schema_id] = s.[schema_id] WHERE s.name = N'dbo'")
    SQL (25.5ms) SELECT t.name FROM sys.tables AS t INNER JOIN sys.schemas AS s ON t.[schema_id] = s.[schema_id] WHERE s.name = N'dbo'
    => #<ActiveRecord::Result:0x007fe390734800 @columns=["name"], @rows=[["spt_fallback_db"], ["spt_fallback_dev"], ["spt_fallback_usg"], ["spt_monitor"]], @hash_rows=nil, @column_types={}>

    when pointing to the prod database where the query is failing. When I run it on the prod database where the Location query works, it sees all 44 tables as expected.

    So, ultimately, i agree ... it is a perms issue.

    Syed Faraaz Ahmad
    @faraazahmad
    HI!
    does tiny_tds work for ruby 2.5?
    Dov s
    @Dohv
    Hi, I am a beginner programmer and new to ruby on rails. I am trying to deploy a ruby on rails app with sql server using tiny_tds. It works locally using an azure sql server db but I am unable to deploy to an azure web app with tiny_tds. It seems as though the freetds library needs to be on the azure web app before installing the tiny_tds gem. This is the error I get when I push to azure: remote: Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
    remote:
    remote: current directory: /tmp/bundle/gems/tiny_tds-2.1.1/ext/tiny_tds
    remote: /usr/local/.rbenv/versions/2.3.3/bin/ruby -r ./siteconf20180314-3087-2d24bj.rb
    remote: extconf.rb
    remote: checking for sybfront.h... yes
    remote: checking for sybdb.h... yes
    remote: checking for tdsdbopen() in -lsybdb... yes
    remote: checking for dbanydatecrack() in -lsybdb... no
    remote: Failed! Do you have FreeTDS 0.95.80 or higher installed?
    remote: extconf.rb failed
    remote: Could not create Makefile due to some reason, probably lack of necessary
    remote: libraries and/or headers. Check the mkmf.log file for more details. You may
    remote: need configuration options.
    remote:
    remote: Provided configuration options:
    remote: --with-opt-dir
    remote: --without-opt-dir
    remote: --with-opt-include
    remote: --without-opt-include=${opt-dir}/include
    remote: --with-opt-lib
    remote: --without-opt-lib=${opt-dir}/lib
    remote: --with-make-prog
    remote: --without-make-prog
    remote: --srcdir=.
    remote: --curdir
    remote: --ruby=/usr/local/.rbenv/versions/2.3.3/bin/$(RUBY_BASE_NAME)
    remote: --help
    remote: --with-freetds-dir
    remote: --without-freetds-dir
    remote: --with-freetds-include
    remote: --without-freetds-include=${freetds-dir}/include
    remote: --with-freetds-lib
    remote: --without-freetds-lib=${freetds-dir}/lib
    remote: --with-freetds-dir
    remote: --without-freetds-dir
    remote: --with-freetds-include
    remote: --without-freetds-include=${freetds-dir}/include
    remote: --with-freetds-lib
    remote: --without-freetds-lib=${freetds-dir}/lib
    remote: --with-sybdblib
    remote: --without-sybdblib
    remote: --with-sybdblib
    remote: --without-sybdblib
    remote:
    remote: To see why this extension failed to compile, please check the mkmf.log which can
    remote: be found here:
    remote:
    remote: /tmp/bundle/extensions/x86_64-linux/2.3.0-static/tiny_tds-2.1.1/mkmf.log
    remote:
    remote: extconf failed, exit code 1
    remote:
    remote: Gem files will remain installed in /tmp/bundle/gems/tiny_tds-2.1.1 for
    remote: inspection.
    remote: Results logged to
    remote: /tmp/bundle/extensions/x86_64-linux/2.3.0-static/tiny_tds-2.1.1/gem_make.out
    remote:
    remote: An error occurred while installing tiny_tds (2.1.1), and Bundler cannot
    remote: continue.
    remote: Make sure that gem install tiny_tds -v '2.1.1' succeeds before bundling.
    remote: An error has occurred during web site deployment.
    remote: bundler failed
    Ben
    @BenMcH
    Is there a way to make new versions of the gem (compatible with rails 5) also compatible with an old sql server? We're rewriting an ancient application on rails 5 and would like to have both versions running in parallel during development. The old application runs off of a 2005 MSSQL Server, while our newer sql db is 2012. We are eventually planning on migrating everything to the new DB, but the old app is rails 2 and can't connect to SQL Server 2012. We'd like to avoid migrating both the sql server and the rails app at the same time if we can avoid it
    Ryan Condron
    @rebelweb
    I am digging through the changes between 5.1 & 5.2 and i have started to compile a list of changes just trying to get the tests to run, I am not sure opening issues is the best since these are pretty basic, i.e. removed files from ActiveRecord or Arel that are referenced.
    Renato Marinho
    @renatomarinho
    This message was deleted
    Aymeric Maire
    @mairea
    hi there
    Renato Marinho
    @renatomarinho
    This message was deleted
    Jeffrey M Castro
    @jeffreycastro

    hello guys, i have a question about the limit method as i am having an issue with pagination.

    the code records.page(1).limit(10)
    gives this sql command: ... [users].[id] IN (1, 2, 3, 4, 9, 3, 5, 8, 10, 6)

    notice that the ID = 3 is used twice.. resulting in incorrect pagination (returning 9 records instead of 10), any help is appreciated on how to fix this.

    i am using rails 5.1.4 with docker image for mssqlserver 2017
    Bobby McDonald
    @BobbyMcWho
    Is there a way to configure the adapter to not use every table in the connected database?
    Bobby McDonald
    @BobbyMcWho
    Why does the adapter run a query to get a default value again, when it should already be there from this line of code
    rohitkumar25
    @rohitkumar25
    Hi
    Klaus
    @KDGundermann
    @jeffreycastro could you pleas give us some more infos? what is "records" and why is it selecting on "users"?
    @BobbyMcWho The adapter uses no tables, its your code which accesses tables.
    Jeffrey M Castro
    @jeffreycastro
    @KDGundermann thanks for taking time to read my message, i will get back to you on this tomorrow :)
    Jeffrey M Castro
    @jeffreycastro

    @KDGundermann I think the reason is the "includes" vs "left_joins".
    Device.left_joins(:health_records).order('health_records.error_number desc').page(1).limit(10).count returns 10

    Device.includes(:health_records).order('health_records.error_number desc').page(1).limit(10).count returns 3

    the only difference is includes and left_joins in the queries above. can you explain to me why?
    Jeffrey M Castro
    @jeffreycastro
    i think i got it now.
    used left_joins and subqueries + select to be able to order properly.
    Klaus
    @KDGundermann
    ;-)
    Tushar Pal
    @tpal94
    Hi anyone here
    kadru
    @kadru
    how is going the progress to run this gem on rails 5.2?
    MrNagoo
    @MrNagoo_gitlab
    running ruby 2.4.0 and following a tutorial. Getting undefined method `alias_method_chain' for #<Class:ActiveRecord::Base> (NoMethodError) Everytime I require this gem
    non-rails
    MrNagoo
    @MrNagoo_gitlab
    ok nvm
    figured it out. I had to clear my local gemset in rvm and lock my active record to ~>5.1
    then install the other gems
    Fj00
    @Fj00
    hello
    I need to set up a connection with sql server 2008 in rails
    all I want to make is a direct sql connection that I can write sql queries
    I have the database credentials
    would need 1. set up the database connection, 2. sql interface to database