<commit_before>require File.join(File.dirname(__FILE__), '..', 'lib', 'manage_fixtures.rb')

desc "use rake db:fixtures:export_using_query SQL=\"select * from foo where id='bar'\" FIXTURE_NAME=foo"
namespace :db do  
  namespace :fixtures do
    task :export_using_query => :environment do
      write_yaml_fixtures_to_file(ENV['SQL'], ENV['FIXTURE_NAME'])
    end
  end
end
 
desc 'use rake db:fixtures:export_for_tables TABLES=foos[,bars,lands] Create YAML test fixtures for a specific table(s) from data in an existing database. Defaults to development database. Set RAILS_ENV to override. ' 
namespace :db do  
  namespace :fixtures do
    task :export_for_tables => :environment do 
      sql = "SELECT * FROM %s" 
      tables = ENV['TABLES'] 
      ActiveRecord::Base.establish_connection 
      tables.each do |table_name| 
        write_yaml_fixtures_to_file(sql % table_name, table_name)
      end 
    end
  end
end 
 
 
desc ' Create YAML test fixtures from data in an existing database. Defaults to development database. Set RAILS_ENV to override. ' 
namespace :db do  
  namespace :fixtures do
    task :export_all => :environment do 
      sql = "SELECT * FROM %s" 
      skip_tables = ["schema_info"] 
      ActiveRecord::Base.establish_connection 
      (ActiveRecord::Base.connection.tables - skip_tables).each do |table_name| <commit_msg>removed created_at and updated_at columns when importing<commit_after>require File.join(File.dirname(__FILE__), '..', 'lib', 'manage_fixtures.rb')

desc "use rake db:fixtures:export_using_query SQL=\"select * from foo where id='bar'\" FIXTURE_NAME=foo"
namespace :db do  
  namespace :fixtures do
    task :export_using_query => :environment do
      write_yaml_fixtures_to_file(ENV['SQL'], ENV['FIXTURE_NAME'])
    end
  end
end
 
desc 'use rake db:fixtures:export_for_tables TABLES=foos[,bars,lands] Create YAML test fixtures for a specific table(s) from data in an existing database. Defaults to development database. Set RAILS_ENV to override. ' 
namespace :db do  
  namespace :fixtures do
    task :export_for_tables => :environment do 
      ActiveRecord::Base.establish_connection 
      tables = ENV['TABLES'].split(',') 
      sql = "SELECT %s FROM %s"
      tables.each do |table_name|
        fields = (table_name.singularize.camelize.constantize.column_names - ['created_at', 'updated_at']).join(', ')
        write_yaml_fixtures_to_file(sql % [fields, table_name], table_name)
      end 
    end
  end
end 
 
 
desc ' Create YAML test fixtures from data in an existing database. Defaults to development database. Set RAILS_ENV to override. ' 
namespace :db do  
  namespace :fixtures do
    task :export_all => :environment do 
      sql = "SELECT * FROM %s" 
      skip_tables = ["schema_info"] 
      ActiveRecord::Base.establish_connection 
      (ActiveRecord::Base.connection.tables - skip_tables).each do |table_name| 
{'fraction_non_alphanumeric': 0.09740932642487046, 'fraction_numerical': 0.0, 'mean_word_length': 3.8754208754208754, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 1, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5174946', 'n_tokens_mistral': 920, 'n_tokens_neox': 876, 'n_words': 258}