The config element

The config element is always root element in a .cphrase file. Its DTD-based definition is:

<!ELEMENT config (table|view|report|cascade)*>
<!ATTLIST config
          id CDATA #REQUIRED
          db CDATA #REQUIRED
          language CDATA #IMPLIED
          version CDATA #IMPLIED
          description CDATA #IMPLIED>

id is the identifier of the configuration. The folder and .cphrase and .py files associated with this configuration will all use this identifier.

db specifies how to connect to the underlying database. In stand-alone mode the actual database may not be built yet. If so, then launching NLIs will result in an error message reminding the administrator to build an SQLite database. The specific format of the db attribute is a text string that always starts with either postgresql:, mysql:, sqlite: or sqlserver: followed by a connection string. In the case of SQLite, the connection string is simply the name of the database file. For example, db="sqlite:personal.db" specifies the local SQLite database.

To help, we have two databases running on a remote server that you should be able to connect to via the following database connection strings.

 postgresql:dbname=northwind host= user=readonly password=db123 port=5432

Note that if you are uncomfortable having the password as clear text in the connection string of the .cphrase file, you may access passwords via environmental variables. Thus the following would work:

postgresql:dbname=northwind host= user=readonly password=$NW_PW port=5432
As long as the environmental variables are set. The recommended way to set these in the .bashrc of your log-in on the C-Phrase host. For example if the .bashrc file contained:

export WORLD_PW=db123
export NW_PW=db123

Now that you have confirmed that you can access these databases, to connect to your own database, you must have a user account with a password on the remote database. You must also ensure that your database server allows for remote connections from your running server. Assuming this is achieved, configurations for remote databases require a connection string like the two example above to be supplied. These connection strings can be fairly complex, but they always start with the database engine (either postgresql, mysql or sqlserver) followed by a psycopg2, pymysql or pymssql compatible connection string.

language is an optional comma separated list of languages with the first language being the dominant one. Its default value is language="english". Since C-Phrase currently only supports Swedish and English, this could in its most complex form be language="swedish,english" which would mean that both English and Swedish would be covered, but paraphrases and messages would be in Swedish.

version This is the original version of C-Phrase the configuration was built with. This is helpful for future upgrade routines that might be run over configurations if we run into backward compatibility problems.


Within the config element, sub-elements represent tables, views, reports and then string processing directives in cascade.

Virtual Config element

To support multi-tenancy, C-Phrase includes Virtual Configs.