Name

sqimport.pl — Squore import utility

Synopsis

sqimport.pl [ option ...] users [ -P | -r ]

sqimport.pl [ option ...] groups [ -m ]

Description

The sqimport.pl script imports CSV data into the Squore database.

The script stops as soon as an error is encountered (SQL constraint violation, invalid input format, etc.), and modifications are discarded.

Users import

sqimport.pl users [ -P | -r ]

This command imports Squore users.

The CSV shall contain these columns (columns are mandatory, unless explicitly specified):

  1. login - the login of the user.

  2. fullname - the full name of the user.

  3. email - the e-mail of the user.

  4. password - the SHA-1 of the user password, base 64 encoded, or the password in clear if the -P option has been specified (optional).

  5. department - the department of the user (optional).

Users have additional properties in Squore, like the number of connections, the selected locale, etc. Such properties are set to their default value.

When the -r is set, this command imports Squore user profiles instead. The CSV shall contain these columns (columns are mandatory):

  1. login - the login of the user.

  2. profile - the profile of the user.

Groups import

sqimport.pl groups [ -m ]

This command imports Squore groups.

The CSV shall contain this column:

  1. group - the name of the group.

When the -m option is used, group members are imported into Squore, and the input file shall have these columns:

  1. group - the name of the group.

  2. login - the login of the group member.

Global options

These options are common to all import types.

-h host

Overrides the database host name.

-p port

Overrides the database port number.

-d dbname

Overrides the database name.

-u user

Overrides the database user name.

-f file

Set the CSV input file. If not specified, CSV data is read from the standard input.

-s sep

Set the CSV separator. Defaults to the ';' character.

-n

The CSV file does not contain the header line.

-S slices

Specifies the subset of columns to use, in the CSV input file, starting from 0. This can be used to reorder input columns as well. Separate column numbers with the ',' character.

-v

Turns on the verbose mode.

Import options

-m

The CSV input contains group membership definitions.

Examples

sqimport.pl -f users.csv users

This command imports users defined in the users.csv file into the database.

Exit status

0

CSV successfully imported.

2

Syntax or usage error.

*

The script failed. See stderr for an error message.