<commit_before>module Chouette #:nodoc:
  class Railtie < Rails::Railtie #:nodoc:
    rake_tasks do
      load Pathname.new(__FILE__) + ".." + ".." + "tasks" + "database.rake"
    end
    initializer "initialize connection to Chouette" do
      config.after_initialize do
        Chouette::ActiveRecord.establish_connection Rails.configuration.database_configuration[ "chouette"]
      end
    end
  end
end<commit_msg>Raise exception when Chouette connexion is not established. Refs #103<commit_after>module Chouette #:nodoc:
  class Railtie < Rails::Railtie #:nodoc:
    rake_tasks do
      load Pathname.new(__FILE__) + ".." + ".." + "tasks" + "database.rake"
    end
    initializer "initialize connection to Chouette" do
      config.after_initialize do
        Chouette::ActiveRecord.establish_connection Rails.configuration.database_configuration[ "chouette"]
        # get connection effective
        # raise PGError if connection fails
        Rails.logger.debug("Chouette db counts #{Chouette::Line.count} lines")
      end
    end
  end
end
{'fraction_non_alphanumeric': 0.09885931558935361, 'fraction_numerical': 0.0028517110266159697, 'mean_word_length': 3.480851063829787, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4126974', 'n_tokens_mistral': 326, 'n_tokens_neox': 304, 'n_words': 79}