import click


def parse_partial(ctx, param, value):
    """Parse values for `partial` option. They should be in the format `table:select SQL`."""

    def parse_value(value):
        try:
            table_name, sql = value.split(":", 1)
            return table_name.strip(), sql.strip()
        except ValueError:
            raise click.exceptions.BadParameter(
                'partial table specification should be in the following format: "table:select SQL"',
                param=param,
            )

    return dict(parse_value(partial) for partial in value)