App-MysqlUtils

 view release on metacpan or  search on metacpan

README  view on Meta::CPAN


    *   count => *bool*

        Instead of returning the CSV rows, just return the count of rows
        that get filled.

    *   database* => *str*

        (No description)

    *   escape_char => *str*

        Specify character to escape value in field in input CSV, will be
        passed to Text::CSV_XS.

        Defaults to "\\" (backslash). Overrides "--tsv" option.

    *   filename* => *filename*

        Input CSV file.

    *   header => *bool* (default: 1)

README  view on Meta::CPAN

        Specify field separator character in input CSV, will be passed to
        Text::CSV_XS.

        Defaults to "," (comma). Overrides "--tsv" option.

    *   tsv => *bool*

        Inform that input file is in TSV (tab-separated) format instead of
        CSV.

        Overriden by "--sep-char", "--quote-char", "--escape-char" options.
        If one of those options is specified, then "--tsv" will be ignored.

    *   username => *str*

        Will try to get default from "~/.my.cnf".

    Special arguments:

    *   -dry_run => *bool*

lib/App/MysqlUtils.pm  view on Meta::CPAN

=over 4

=item * B<count> => I<bool>

Instead of returning the CSV rows, just return the count of rows that get filled.

=item * B<database>* => I<str>

(No description)

=item * B<escape_char> => I<str>

Specify character to escape value in field in input CSV, will be passed to Text::CSV_XS.

Defaults to C<\\> (backslash). Overrides C<--tsv> option.

=item * B<filename>* => I<filename>

Input CSV file.

=item * B<header> => I<bool> (default: 1)

Whether input CSV has a header row.

lib/App/MysqlUtils.pm  view on Meta::CPAN

=item * B<sep_char> => I<str>

Specify field separator character in input CSV, will be passed to Text::CSV_XS.

Defaults to C<,> (comma). Overrides C<--tsv> option.

=item * B<tsv> => I<bool>

Inform that input file is in TSV (tab-separated) format instead of CSV.

Overriden by C<--sep-char>, C<--quote-char>, C<--escape-char> options. If one of
those options is specified, then C<--tsv> will be ignored.

=item * B<username> => I<str>

Will try to get default from C<~/.my.cnf>.


=back

Special arguments:

script/mysql-fill-csv-columns-from-query  view on Meta::CPAN

=head1 VERSION

This document describes version 0.022 of mysql-fill-csv-columns-from-query (from Perl distribution App-MysqlUtils), released on 2022-10-19.

=head1 SYNOPSIS

B<mysql-fill-csv-columns-from-query> L<--help|/"--help, -h, -v"> (or L<-h|/"--help, -h, -v">, L<-?|/"--help, -h, -v">)

B<mysql-fill-csv-columns-from-query> L<--version|/"--version, -v"> (or L<-v|/"--version, -v">)

B<mysql-fill-csv-columns-from-query> [(L<--config-path|/"--config-path=s">=I<path>)+|L<--no-config|/"--no-config, -C">|L<-C|/"--no-config, -C">] [L<--config-profile|/"--config-profile=s, -P">=I<profile>|L<-P|/"--config-profile=s, -P">] [L<--count|/"-...

=head1 DESCRIPTION

This utility is handy if you have a partially filled table (in CSV format, which
you can convert from spreadsheet or Google Sheet or whatever), where you have
some unique key already specified in the table (e.g. customer_id) and you want
to fill up other columns (e.g. customer_name, customer_email, last_order_date) from a
query:

 % mysql-fill-csv-columns-from-query DBNAME TABLE.csv 'SELECT c.NAME customer_name, c.email customer_email, (SELECT date FROM tblorders WHERE client_id=$customer_id ORDER BY date DESC LIMIT 1) last_order_time FROM tblclients WHERE id=$customer_id'

script/mysql-fill-csv-columns-from-query  view on Meta::CPAN

If you specify C<--no-env>, the application wil not read any environment
variable.


=back

=head2 Input options

=over

=item B<--escape-char>=I<s>

Specify character to escape value in field in input CSV, will be passed to Text::CSV_XS.

Defaults to C<\\> (backslash). Overrides C<--tsv> option.


=item B<--no-header>, B<--input-header>

By default (C<--header>), the first row of the CSV will be assumed to contain
field names (and the second row contains the first data row). When you declare
that CSV does not have header row (C<--no-header>), the first row of the CSV is
assumed to contain the first data row. Fields will be named C<field1>, C<field2>,

script/mysql-fill-csv-columns-from-query  view on Meta::CPAN


Specify field separator character in input CSV, will be passed to Text::CSV_XS.

Defaults to C<,> (comma). Overrides C<--tsv> option.


=item B<--tsv>, B<--input-tsv>

Inform that input file is in TSV (tab-separated) format instead of CSV.

Overriden by C<--sep-char>, C<--quote-char>, C<--escape-char> options. If one of
those options is specified, then C<--tsv> will be ignored.


=back

=head2 Logging options

=over

=item B<--debug>

script/mysql-fill-csv-columns-from-query  view on Meta::CPAN

 arg2=val2

 

which is equivalent to setting C<< -plugins=-DumpArgs@before_validate_args@99,-Foo@after_validate_args,arg1,val1,arg2,val2 >>.

List of available configuration parameters:

 count (see --count)
 database (see --database)
 escape_char (see --escape-char)
 filename (see --filename)
 format (see --format)
 header (see --no-header)
 host (see --host)
 log_level (see --log-level)
 naked_res (see --naked-res)
 password (see --password)
 port (see --port)
 query (see --query)
 quote_char (see --quote-char)



( run in 0.435 second using v1.01-cache-2.11-cpan-c21f80fb71c )