LibreCat / Catmandu-DBI

A Catmandu::Store plugin for DBI based interfaces
Other
0 stars 1 forks source link

Error if database does not exist (mysql-driver) #8

Closed vpeil closed 9 years ago

vpeil commented 9 years ago

Here's my catmandu.yml (tested with the mysql driver)

store:
  default:
    package: DBI 
    options:
      data_source: "DBI:mysql:database=test"
      username: whoami
      password: secret

The command

$ echo '{"hello" : "world"}' | catmandu import

dies with no database exists. Is this behaviour intentional? In case of Elasticsearch the index gets created if needed. Should we add here a "create database $name"?

nicolasfranck commented 9 years ago

Yes it is. You need the user, the database, and the grant permission to be present in your mysql. A "create database" statement can only succeed if the user is an administrator of mysql, but then you're creating a security hole. If the website using Catmandu is infected, mysql is also.

ElasticSearch out of the box does not have user management (but there is module for that now), so everyone can write, create indexes and so on. But ES is hardly ever used as the first source of data, only as a derivative for searching.

vpeil commented 9 years ago

thanks.