Skip to content


Subversion checkout URL

You can clone with
Download ZIP


Propel Insert SQL #409

harikt opened this Issue · 10 comments

7 participants


It seems the propel inser-sql nor sql:insert inserting the sql to the database

Is it a bug, or am I missing to add something.

no errors nothing is shown.


So I started to look what may be wrong.

I am doing

vendor/bin/propel migration:status --connection bookstore=mysql:host=;dbname=mydb;user=root

exception is

Checking Database Versions...

  SQLSTATE[3D000]: Invalid catalog name: 1046 No database selected                        

In the AbstractCommand I did an echo

connection bookstore=mysql:host=

What I noticed is the extra parameters dbname etc are getting missed

The vardump of connection in MigrationStatusCommand is

array(1) {
  'bookstore' =>
  array(3) {
    'dsn' =>
    string(20) "mysql:host="
    'mysql:host' =>
    string(9) ""
    'adapter' =>
    string(5) "mysql"

I have

# Database driver
propel.database = mysql

# Project name
propel.project = bookstore

propel.database.url = mysql:host=localhost;dbname=test
propel.database.user = root
propel.database.password = password

propel.project.dir = /media/Linux/aurasystem

# The directory where Propel expects to find the XML configuration files.
propel.conf.dir = /media/Linux/aurasystem

propel.runtime.conf.file = runtime-conf.xml
propel.buildtime.conf.file = buildtime-conf.xml

and buildtime-conf.xml

<?xml version="1.0" encoding="UTF-8"?>
  <!-- Uncomment this if you have PEAR Log installed
    <datasources default="bookstore">
      <datasource id="bookstore">
        <adapter>mysql</adapter> <!-- sqlite, mysql, mssql, oracle, or pgsql -->

weird issue, it should not fail that way.


I have the exact same issue with a PostgreSQL application. The generated SQL code seems fine and there is no error when I run propel sql:insert but the tables aren't created :

$ psql foo
psql (9.3.1)
Type "help" for help.

foo=# \d
No relations found.
@robin850 robin850 referenced this issue in propelorm/

[RFC] Documentation, Propel & Propel2 #235


Are there any improvements or updates on the issue? I'm having the same issue - sql:insert does nothing .. no errors, no tables.

@evansims evansims referenced this issue from a commit
@evansims evansims Look for and in appropriate directories.
Fixes propelorm/Propel2#409 by configuring appropriate working directories to access necessary files for sql:inject command.

@harikt The semicolons are breaking up your connection string (semicolons in shell are considered returns); if you escape them it should get passed correctly.

propel insert-sql --connection bookstore=mysql:host=\;dbname=mydb\;user=root

I've submitted a pull request that fixes the underlying issue with insert-sql failing, however.


Thank you for the information @evansims . And great for the :+1: PR

@harikt harikt closed this

@robin850 the hint with the escaped semicolon when used from CLI should be noted somewhere in the docs, I guess?


In the UNIX doc I'd say, ; separates commands in a shell.

edit: nevermind, misread last comment. sure the doc should be updated accordingly


The probably better way'd be just to surround the connection string with single quotes, also good to pass passwords that contain $ chars.

$ propel insert-sql --connection 'bookstore=mysql:host=;dbname=mydb;user=root'

@marcj good point... we should just note in the docs which notation is prefered

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.