<commit_before>#!/usr/bin/perl

use common::sense;

use FindBin qw($Script);
use Getopt::Long;
use Log::Log4perl qw(:easy);

use Capsulary::DB::Redis;
use Capsulary::DB::SqlServer;

BEGIN
{
    Log::Log4perl->easy_init($INFO);

    # The SQL Server ODBC driver sometimes craps out with "Unexpected EOF from
    # the server" if this isn't specified.
    $ENV{TDSVER} = '7.0';
}

use constant BASE => 'eve';
use constant SCHEMA => 'dbo';
use constant ETL =>
[
    {
        '__reference_name' => 'type',
        '__table' => 'invTypes',
        '__primary_key' => 'typeID',
        '__backref' =>
        {
            by       => 'name',
            referrer => 'typeName',
        },
        'typeID' => 'id',
        'groupID' => 'group_id',
        'typeName' => 'name',
        'description' => 'description',
        'graphicID' => 'graphic_id',
        'radius' => 'radius',
        'mass' => 'mass',
        'volume' => 'volume',
        'capacity' => 'capacity',
        'portionSize' => 'portion_size',
        'raceID' => 'race_id',
        'basePrice' => 'base_price',
        'published' => 'published',
        'marketGroupID' => 'market_group_id',
        'chanceOfDuplicating' => 'chance_of_duplicating',
        'iconID' => 'icon_id',
    },
];

my $opt_dsn;
my $opt_username;
my $opt_password;
my $opt_help;
my $opt_redis_host = 'localhost';
my $opt_redis_port = 6379;
my $opt_debug_output;
my @opt_tables;
my %_opt_tables;
my $opt_dry_run;

sub usage
{
    say STDERR 'FATAL: ', @_ if @_;

    say "Usage: $Script <-d DSN> <-u USERNAME> <-p PASSWORD>";
    say "Required:";
    say "    -d DSN         The DSN, as defined in your odbc.ini file,";
    say "                   to use for SQL Server";
    say "    -u USERNAME    The username to use for SQL Server";
    say "    -p PASSWORD    The password to use for SQL Server";
    say "Optional:";
    say "    --debug            Enable debug (trace, actually) output";
    say "    -h                 Print this helpful usage information";
    say "    --redis-host HOST  The Redis hostname [localhost]";
    say "    --redis-port PORT  The Redis port [6379]";
    say "    --tables T1,T2,... A list of tables to export (do not include";
    say "                       \"dbo\" schema prefix) [all tables]";<commit_msg>Add chrRaces table.<commit_after>#!/usr/bin/perl

use common::sense;

use FindBin qw($Script);
use Getopt::Long;
use Log::Log4perl qw(:easy);

use Capsulary::DB::Redis;
use Capsulary::DB::SqlServer;

BEGIN
{
    Log::Log4perl->easy_init($INFO);

    # The SQL Server ODBC driver sometimes craps out with "Unexpected EOF from
    # the server" if this isn't specified.
    $ENV{TDSVER} = '7.0';
}

use constant BASE => 'eve';
use constant SCHEMA => 'dbo';
use constant ETL =>
[
    {
        '__reference_name' => 'type',
        '__table' => 'invTypes',
        '__primary_key' => 'typeID',
        '__backref' =>
        {
            by       => 'name',
            referrer => 'typeName',
        },
        'typeID' => 'id',
        'groupID' => 'group_id',
        'typeName' => 'name',
        'description' => 'description',
        'graphicID' => 'graphic_id',
        'radius' => 'radius',
        'mass' => 'mass',
        'volume' => 'volume',
        'capacity' => 'capacity',
        'portionSize' => 'portion_size',
        'raceID' => 'race_id',
        'basePrice' => 'base_price',
        'published' => 'published',
        'marketGroupID' => 'market_group_id',
        'chanceOfDuplicating' => 'chance_of_duplicating',
        'iconID' => 'icon_id',
    },
    {
        '__reference_name' => 'race',
        '__table' => 'chrRaces',
        '__primary_key' => 'raceID',
        '__backref' =>
        {
            by       => 'name',
            referrer => 'raceName',
        },
        'raceID' => 'id',
        'raceName' => 'name',
        'description' => 'description',
        'iconID' => 'icon_id',
        'shortDescription' => 'short_description',
    },
];

my $opt_dsn;
my $opt_username;
my $opt_password;
my $opt_help;
my $opt_redis_host = 'localhost';
my $opt_redis_port = 6379;
my $opt_debug_output;
my @opt_tables;
my %_opt_tables;
my $opt_dry_run;

sub usage
{
    say STDERR 'FATAL: ', @_ if @_;

    say "Usage: $Script <-d DSN> <-u USERNAME> <-p PASSWORD>";
    say "Required:";
    say "    -d DSN         The DSN, as defined in your odbc.ini file,";
    say "                   to use for SQL Server";
    say "    -u USERNAME    The username to use for SQL Server";
    say "    -p PASSWORD    The password to use for SQL Server";
    say "Optional:";
    say "    --debug            Enable debug (trace, actually) output";
    say "    -h                 Print this helpful usage information";
    say "    --redis-host HOST  The Redis hostname [localhost]";
    say "    --redis-port PORT  The Redis port [6379]";
    say "    --tables T1,T2,... A list of tables to export (do not include";
    say "                       \"dbo\" schema prefix) [all tables]";
{'fraction_non_alphanumeric': 0.1542925755453272, 'fraction_numerical': 0.005603362017210326, 'mean_word_length': 2.203846153846154, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 72, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1046585', 'n_tokens_mistral': 1735, 'n_tokens_neox': 1682, 'n_words': 452}