Changes between Version 2 and Version 3 of DatabaseBasedAnalysis/table2sql


Ignore:
Timestamp:
08/07/18 16:40:52 (6 years ago)
Author:
tbretz
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • DatabaseBasedAnalysis/table2sql

    v2 v3  
    2323
    2424== Basics ==
    25 
    26 Root to SQL:
    27   -u [ --uri ] arg              Database link as in
    28                                 user:password@server[:port]/database[?compress=
    29                                 0|1].
    30   --file arg                    The root file to read from
    31   --force                       Force processing even if there is no database
    32                                 connection
    33   --create                      Create the database if not existing
    34   --drop                        Drop the table (implies create)
    35   -t [ --tree ] arg (=Events)   Name of the root tree to convert
    36   --table arg                   Name of the table to use (default is the tree
    37                                 name)
    38   --map arg                     A regular expression which is applied to the
    39                                 leaf name befoee it is used as SQL column name)
    40   --sql-type arg                Allows to overwrite the calculated SQL type for
    41                                 a given column e.g. 'sql-column-name/UNSIGNED
    42                                 IN'
    43   --ignore arg                  Ignore the given leaf, if the given regular
    44                                 expression matches
    45   --primary arg                 List of columns to be used as primary keys
    46                                 during table creation (in connection with
    47                                 --create)
    48   --first arg (=0)              First event to start with (default: 0), mainly
    49                                 for test purpose
    50   --max arg (=0)                Maximum number of events to process (0: all),
    51                                 mainly for test purpose
    52   --engine arg                  Database engine to be used when a new table is
    53                                 created
    54   --row-format arg              Defines the ROW_FORMAT keyword for table
    55                                 creation
    56   --duplicate arg               Specifies an assignment_list for an 'ON
    57                                 DUPLICATE KEY UPDATE' expression
    58   --ignore-errors               Adds the IGNORE keyword to the INSERT query
    59                                 (turns errors into warnings, ignores rows with
    60                                 errors)
    61 
    62 Debug options:
    63   --no-insert                   Does not insert any data into the table
    64   --dry-run                     Skip any query which changes the databse (might
    65                                 result in consecutive failures)
    66   --print-connection            Print database connection information
    67   --print-branches              Print the branches found in the tree
    68   --print-leaves                Print the leaves found in the tree (this is
    69                                 what is processed)
    70   --print-insert                Print the INSERT query (note that it contains
    71                                 all data)
    72   --print-create                Print the CREATE query
    73   -v [ --verbose ] arg (=1)     Verbosity (0: quiet, 1: default, 2: more, 3,
    74 
    7525
    7626Generally, ROOT-files can store very complicated object as a TH1F. Although, they could be entered in a database as a so called BLOB (a binary object), this is not the idea of the tool. Thus only basic data types are supported.
     
    207157The complete `INSERT` query can be printed with `--print-insert`. Note that this can be a quite long output.
    208158
     159For test purposes, the number of events and the events which are processed can be altered with `--first` and `--max`.
     160
    209161== Performance ==
    210162
     
    219171In case of success, 0 is returned, a value>0 otherwise.
    220172
     173== fits2sql ==
     174
     175The `fits2sql` executable works mainly identical to the `root2sql` executable, except that the ROOT-tree here is a so-called FITS-extension (table). Therefore, the `--tree` option is called `--extension`.
     176
     177For debugging, `--print-extension` shows the columns of a FITS extension and `--print-columns` a list of all columns.
     178
     179As a default, integer columns in FITS-files contain signed values. To convert them to unsigned columns, the `--unsigned` option can be given follows by a column name. It can be given more than once to apply that to more than one column.
     180
     181A specialty of FITS-extensions is that they can contains fixed-size arrays of numbers. If the array is called ARR and has 3 fields, the SQL columns will be called ARR[0], ARR[1] and ARR[2]. All modifier options working on columns always alter all corresponding columns at once.
    221182
    222183
    223184
    224