Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

include_sql_query requests unuseful parameters for CSV database driver #1437

Closed
ikedas opened this issue Jul 6, 2022 · 4 comments · Fixed by #1505
Closed

include_sql_query requests unuseful parameters for CSV database driver #1437

ikedas opened this issue Jul 6, 2022 · 4 comments · Fixed by #1505
Assignees
Labels
bug ready A PR is waiting to be merged. Close to be solved
Milestone

Comments

@ikedas
Copy link
Member

ikedas commented Jul 6, 2022

(This issue was separated from the issue #1434.)

Version

At least 6.2.48 and later.

Installation method

Any.

Expected behavior

CSV driver requests only necessary parameters, which are currently db_type and f_dir.

Actual behavior

According to a report, Sympa won't let you define an include_sql_query without db_name, db_host and db_user.

Steps to reproduce

See "Steps to reproduce" in #1434 .

Additional information

Some parameters are inconsistent in usage across the various contexts of configurations. Correction will be suggested in subsequent comment.

@ikedas ikedas added the bug label Jul 6, 2022
@ikedas
Copy link
Member Author

ikedas commented Jul 6, 2022

Current situation and suggestion

Current situation (at 6.2.68)

Parameter usage in sympa.conf described in the manual:

MySQL Oracle PostgreSQL SQLite ODBC (undocumented)*
db_type required required required required required
db_name required required required required required
db_host required (optional) required - -
db_port (optional) (optional) (optional) - -
db_user required required required - required
db_passwd (optional) required (optional) - required
db_env - required (available, but unuseful) - -
db_timeout - - - (optional) -
db_options (optional) (optional) (optional) - -

* According to parameter usage in Sympa::DatabaseDriver::ODBC.

Parameter usage for the other SQL driver:

CSV *
db_type required
f_dir required
db_options (optional)

* According to parameter usage in Sympa::DatabaseDriver::CSV.

Parameter definition in configuration schema (form 'sympa.conf' and data source definitions):

db_* in sympa.conf include_sql_*.db_*
db_type required required
db_name omittable* required
db_host (optional) (optional)
db_port (optional) (optional)
db_user (optional) required
db_passwd (optional) (optional)
db_env (optional) (optional)
db_timeout (optional) -
db_options (optional) (optional)
f_dir - (optional)

* "sympa" by default.

Suggestion

Corrections below are suggested:

  1. The parameter f_dir specific to CSV driver should be renamed to db_name, and therefore db_name should be required parameter not according to db type.
  2. db_user (and maybe also db_host as some reported) shouldn't be the required parameter in include_sql_* paragraph: Particular type of driver may require them.

@salaun-urennes1
Copy link
Collaborator

I agree with your proposal.

@racke
Copy link
Contributor

racke commented Jul 6, 2022

Yes, makes lots of sense to rename f_dir to db_name. 👍

@ikedas ikedas self-assigned this Jul 8, 2022
@ikedas ikedas added the ready A PR is waiting to be merged. Close to be solved label Oct 27, 2022
@ikedas
Copy link
Member Author

ikedas commented Oct 27, 2022

Please check the PR above.
(For 6.2.48 please check the commit bcc1189 ).

@racke racke added this to the 6.2.72 milestone Nov 5, 2022
ikedas added a commit that referenced this issue Nov 16, 2022
include_sql_query requests unuseful parameters for CSV database driver (#1437)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug ready A PR is waiting to be merged. Close to be solved
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants