3. names¶
Last page update: September 22, 2015
3.1. name_full¶
The “name_full” is a string that can include:
- the full (TODO differences with the “name_long”?) name of a database table
- the full (TODO) name of the table columns
- the full (TODO) name of a database schema (check the config_attributes() section)
- the full (TODO) name of a package
You can specify multiple languages adding the ”!!” characters to the begin of the string. More information in the languages section
Check the examples below
3.2. name_long¶
The “name_long” is a string that can include:
- the full (TODO differences with the “name_full”?) name of a database table
- the full (TODO) name of the table columns
- the full (TODO) name of a database schema (check the config_attributes() section)
- the full (TODO) name of a package
You can specify multiple languages adding the ”!!” characters to the begin of the string. More information in the languages section
Check the examples below
3.3. name_short¶
The “name_short” is a string that can include:
- the abbreviation name of a database table
- the abbreviation name of the table columns
- the abbreviation name of a database schema (check the config_attributes() section)
- the abbreviation name of a package
You can specify multiple languages adding the ”!!” characters to the begin of the string. More information in the languages section
Check the examples below
3.4. name_plural¶
The “name_plural” is a string that can include:
- the plural name of a database table
- the plural name of the table columns
- the plural name of a database schema (check the config_attributes() section)
- the plural name of a package
You can specify multiple languages adding the ”!!” characters to the begin of the string. More information in the languages section
Check the examples below
3.5. examples¶
3.5.1. names in a table and in the columns¶
Let’s see an example of creation of a table with some columns with the names attribute (if you need more information on the creation of a table, please check the table section):
#!/usr/bin/env python # encoding: utf-8 class Table(object): def config_db(self, pkg): tbl = pkg.table('invoice',pkey='id',name_long='!!Invoice',name_plural='!!Invoices', rowcaption='$number,$date:%s (%s)') tbl.column('id',size='22',group='_',readOnly=True,name_long='!!Id') self.sysFields(tbl,id=False) tbl.column('number',size='10',name_long='!!Number') tbl.column('date','D',name_long='!!Date') tbl.column('customer_id',size='22',name_long='!!Customer_ID',validate_notnull=True, validate_notnull_error='!!Customer is mandatory').relation('customer.id',onDelete='raise', mode='foreignkey',relation_name='invoices') tbl.column('net','money',name_long='!!Net') tbl.column('vat','N',size='12',name_long='!!Vat') tbl.column('total','N',size='15,2',name_long='!!Total') tbl.aliasColumn('customer',relation_path='@customer_id.name') tbl.aliasColumn('city',relation_path='@customer_id.city')
3.5.2. names in the config_attributes() method¶
In the main.py file of a project you can set the config_attributes() method through which you define some properties of the database schema:
def config_attributes(self): return dict(sqlschema='agenda', comment='an useful comment', name_short='ag.', name_long='agenda', name_full='agenda')
3.5.3. names in the package creation¶
TODO