Package s3 :: Module s3resource :: Class S3Resource
[frames] | no frames]

Class S3Resource

source code

object --+
         |
        S3Resource


API for resources.

A "resource" is a set of records in a database table including their
references in certain related resources (components). A resource can
be defined like:

    resource = S3Resource(table)

A resource defined like this would include all records in the table.
Further parameters for the resource constructor as well as methods
of the resource instance can be used to filter for particular subsets.

This API provides extended standard methods to access and manipulate
data in resources while respecting current authorization and other
S3 framework rules.

Instance Methods
 
__init__(self, tablename, id=None, prefix=None, uid=None, filter=None, vars=None, parent=None, linked=None, linktable=None, alias=None, components=None, filter_component=None, include_deleted=False, approved=True, unapproved=False, context=False, extra_filters=None)
Constructor
source code
 
build_query(self, id=None, uid=None, filter=None, vars=None, extra_filters=None, filter_component=None)
Query builder
source code
 
add_filter(self, f=None, c=None)
Extend the current resource filter
source code
 
add_component_filter(self, alias, f=None)
Extend the resource filter of a particular component, does not affect the master resource filter (as opposed to add_filter)
source code
 
add_extra_filter(self, method, expression)
And an extra filter (to be applied on pre-filtered subsets)
source code
 
set_extra_filters(self, filters)
Replace the current extra filters
source code
 
get_query(self)
Get the effective query
source code
 
get_filter(self)
Get the effective virtual filter
source code
 
clear_query(self)
Remove the current query (does not remove the set!)
source code
 
count(self, left=None, distinct=False)
Get the total number of available records in this resource
source code
 
select(self, fields, start=0, limit=None, left=None, orderby=None, groupby=None, distinct=False, virtual=True, count=False, getids=False, as_rows=False, represent=False, show_links=True, raw_data=False)
Extract data from this resource
source code
 
insert(self, **fields)
Insert a record into this resource
source code
 
update(self)
Bulk updater, @todo
source code
 
delete(self, format=None, cascade=False, replaced_by=None, log_errors=False)
Delete all records in this resource
source code
 
approve(self, components=(), approve=True, approved_by=None)
Approve all records in this resource
source code
 
reject(self, cascade=False)
Reject (delete) all records in this resource
source code
 
merge(self, original_id, duplicate_id, replace=None, update=None, main=True)
Merge two records, see also S3RecordMerger.merge
source code
 
datatable(self, fields=None, start=0, limit=None, left=None, orderby=None, distinct=False)
Generate a data table of this resource
source code
 
datalist(self, fields=None, start=0, limit=None, left=None, orderby=None, distinct=False, list_id=None, layout=None)
Generate a data list of this resource
source code
 
json(self, fields=None, start=0, limit=None, left=None, distinct=False, orderby=None)
Export a JSON representation of the resource.
source code
 
load(self, fields=None, skip=None, start=None, limit=None, orderby=None, virtual=True, cacheable=False)
Loads records from the resource, applying the current filters, and stores them in the instance.
source code
 
clear(self)
Removes the records currently stored in this instance
source code
 
records(self, fields=None)
Get the current set as Rows instance
source code
 
__getitem__(self, key)
Find a record currently stored in this instance by its record ID
source code
 
__iter__(self)
Iterate over the records currently stored in this instance
source code
 
get(self, key, component=None, link=None)
Get component records for a record currently stored in this instance.
source code
 
get_id(self)
Get the IDs of all records currently stored in this instance
source code
 
get_uid(self)
Get the UUIDs of all records currently stored in this instance
source code
 
__len__(self)
The number of currently loaded rows
source code
 
__repr__(self)
String representation of this resource
source code
 
__contains__(self, item)
Tests whether this resource contains a (real) field.
source code
 
__nonzero__(self)
Boolean test of this resource
source code
 
export_xml(self, start=None, limit=None, msince=None, fields=None, dereference=True, maxdepth=MAXDEPTH, mcomponents=DEFAULT, rcomponents=None, references=None, mdata=False, stylesheet=None, as_tree=False, as_json=False, maxbounds=False, filters=None, pretty_print=False, location_data=None, map_data=None, target=None, **args)
Export this resource as S3XML
source code
 
export_tree(self, start=0, limit=None, msince=None, fields=None, references=None, dereference=True, maxdepth=MAXDEPTH, mcomponents=None, rcomponents=None, filters=None, mdata=False, maxbounds=False, xmlformat=None, location_data=None, map_data=None, target=None)
Export the resource as element tree
source code
 
import_xml(self, source, files=None, id=None, format="xml", stylesheet=None, extra_data=None, ignore_errors=False, job_id=None, commit_job=True, delete_job=False, strategy=None, update_policy=None, conflict_policy=None, last_sync=None, onconflict=None, **args)
XML Importer
source code
 
import_tree(self, record_id, tree, job_id=None, ignore_errors=False, delete_job=False, commit_job=True, strategy=None, update_policy=None, conflict_policy=None, last_sync=None, onconflict=None)
Import data from an S3XML element tree.
source code
 
export_options(self, component=None, fields=None, only_last=False, show_uids=False, hierarchy=False, as_json=False)
Export field options of this resource as element tree
source code
 
export_fields(self, component=None, as_json=False)
Export a list of fields in the resource as element tree
source code
 
export_struct(self, meta=False, options=False, references=False, stylesheet=None, as_json=False, as_tree=False)
Get the structure of the resource
source code
 
readable_fields(self, subset=None)
Get a list of all readable fields in the resource table
source code
 
resolve_selectors(self, selectors, skip_components=False, extra_fields=True, show=True)
Resolve a list of field selectors against this resource
source code
 
resolve_selector(self, selector)
Wrapper for S3ResourceField, retained for backward compatibility
source code
 
split_fields(self, skip=DEFAULT, data=None, references=None)
Split the readable fields in the resource table into reference and non-reference fields.
source code
 
configure(self, **settings)
Update configuration settings for this resource
source code
 
get_config(self, key, default=None)
Get a configuration setting for the current resource
source code
 
clear_config(self, *keys)
Clear configuration settings for this resource
source code
 
limitby(self, start=0, limit=0)
Convert start+limit parameters into a limitby tuple
source code
 
get_join(self)
Get join for this component
source code
 
get_left_join(self)
Get a left join for this component
source code
 
link_id(self, master_id, component_id)
Helper method to find the link table entry ID for a pair of linked records.
source code
 
component_id(self, master_id, link_id)
Helper method to find the component record ID for a particular link of a particular master record
source code
 
update_link(self, master, record)
Create a new link in a link table if it doesn't yet exist.
source code
 
datatable_filter(self, fields, get_vars)
Parse datatable search/sort vars into a tuple of query, orderby and left joins
source code
 
axisfilter(self, axes)
Get all values for the given S3ResourceFields (axes) which match the resource query, used in pivot tables to filter out additional values where dimensions can have multiple values per record
source code
 
prefix_selector(self, selector)
Helper method to ensure consistent prefixing of field selectors
source code
 
list_fields(self, key="list_fields", id_column=0)
Get the list_fields for this resource
source code
 
get_defaults(self, master, defaults=None, data=None)
Get implicit defaults for new component records
source code

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __setattr__, __sizeof__, __str__, __subclasshook__

Class Methods
 
original(cls, table, record, mandatory=None)
Find the original record for a possible duplicate:
source code
Static Methods
 
components_to_export(tablename, aliases)
Get a list of aliases of components that shall be exported together with the master resource
source code
 
import_fields(table, data, mandatory=None) source code
Properties

Inherited from object: __class__

Method Details

__init__(self, tablename, id=None, prefix=None, uid=None, filter=None, vars=None, parent=None, linked=None, linktable=None, alias=None, components=None, filter_component=None, include_deleted=False, approved=True, unapproved=False, context=False, extra_filters=None)
(Constructor)

source code 

Constructor

Parameters:
  • tablename - tablename, Table, or an S3Resource instance
  • prefix - prefix to use for the tablename
  • id - record ID (or list of record IDs)
  • uid - record UID (or list of record UIDs)
  • filter - filter query
  • vars - dictionary of URL query variables
  • components - list of component aliases to load for this resource
  • filter_component - alias of the component the URL filters apply for (filters for this component must be handled separately)
  • alias - the alias for this resource (internal use only)
  • parent - the parent resource (internal use only)
  • linked - the linked resource (internal use only)
  • linktable - the link table (internal use only)
  • include_deleted - include deleted records (used for synchronization)
  • approved - include approved records
  • unapproved - include unapproved records
  • context - apply context filters
  • extra_filters - extra filters (to be applied on pre-filtered subsets), as list of tuples (method, expression)
Overrides: object.__init__

build_query(self, id=None, uid=None, filter=None, vars=None, extra_filters=None, filter_component=None)

source code 

Query builder

Parameters:
  • id - record ID or list of record IDs to include
  • uid - record UID or list of record UIDs to include
  • filter - filtering query (DAL only)
  • vars - dict of URL query variables
  • extra_filters - extra filters (to be applied on pre-filtered subsets), as list of tuples (method, expression)
  • filter_component - the alias of the component the URL filters apply for (filters for this component must be handled separately)

add_filter(self, f=None, c=None)

source code 

Extend the current resource filter

Parameters:
  • f - a Query or a S3ResourceQuery instance
  • c - alias of the component this filter concerns, automatically adds the respective component join (not needed for S3ResourceQuery instances)

add_component_filter(self, alias, f=None)

source code 

Extend the resource filter of a particular component, does not affect the master resource filter (as opposed to add_filter)

Parameters:
  • alias - the alias of the component
  • f - a Query or a S3ResourceQuery instance

add_extra_filter(self, method, expression)

source code 

And an extra filter (to be applied on pre-filtered subsets)

Parameters:
  • method - a name of a known filter method, or a callable filter method
  • expression - the filter expression (string)

set_extra_filters(self, filters)

source code 

Replace the current extra filters

Parameters:
  • filters - list of tuples (method, expression), or None to remove all extra filters

get_query(self)

source code 

Get the effective query

Returns:
Query

get_filter(self)

source code 

Get the effective virtual filter

Returns:
S3ResourceQuery

clear_query(self)

source code 

Remove the current query (does not remove the set!)

count(self, left=None, distinct=False)

source code 

Get the total number of available records in this resource

Parameters:
  • left - left outer joins, if required
  • distinct - only count distinct rows

select(self, fields, start=0, limit=None, left=None, orderby=None, groupby=None, distinct=False, virtual=True, count=False, getids=False, as_rows=False, represent=False, show_links=True, raw_data=False)

source code 

Extract data from this resource

Parameters:
  • fields - the fields to extract (selector strings)
  • start - index of the first record
  • limit - maximum number of records
  • left - additional left joins required for filters
  • orderby - orderby-expression for DAL
  • groupby - fields to group by (overrides fields!)
  • distinct - select distinct rows
  • virtual - include mandatory virtual fields
  • count - include the total number of matching records
  • getids - include the IDs of all matching records
  • as_rows - return the rows (don't extract)
  • represent - render field value representations
  • raw_data - include raw data in the result

insert(self, **fields)

source code 

Insert a record into this resource

Parameters:
  • fields - dict of field/value pairs to insert

update(self)

source code 

Bulk updater, @todo

delete(self, format=None, cascade=False, replaced_by=None, log_errors=False)

source code 

Delete all records in this resource

@param format: the representation format of the request (optional)
@param cascade: this is a cascade delete (prevents commits)
@param replaced_by: used by record merger
@param log_errors: log errors even when cascade=True

@return: number of records deleted

NB skipping undeletable rows is no longer the default behavior,
   process will now fail immediately for any error; use S3Delete
   directly if skipping of undeletable rows is desired

approve(self, components=(), approve=True, approved_by=None)

source code 

Approve all records in this resource

Parameters:
  • components - list of component aliases to include, None for no components, empty list or tuple to approve all components (default)
  • approve - set to approved (False to reset to unapproved)
  • approved_by - set approver explicitly, a valid auth_user.id or 0 for approval by system authority

reject(self, cascade=False)

source code 

Reject (delete) all records in this resource

merge(self, original_id, duplicate_id, replace=None, update=None, main=True)

source code 

Merge two records, see also S3RecordMerger.merge

datatable(self, fields=None, start=0, limit=None, left=None, orderby=None, distinct=False)

source code 

Generate a data table of this resource

Parameters:
  • fields - list of fields to include (field selector strings)
  • start - index of the first record to include
  • limit - maximum number of records to include
  • left - additional left joins for DB query
  • orderby - orderby for DB query
  • distinct - distinct-flag for DB query
Returns:
tuple (S3DataTable, numrows), where numrows represents the total number of rows in the table that match the query

datalist(self, fields=None, start=0, limit=None, left=None, orderby=None, distinct=False, list_id=None, layout=None)

source code 

Generate a data list of this resource

Parameters:
  • fields - list of fields to include (field selector strings)
  • start - index of the first record to include
  • limit - maximum number of records to include
  • left - additional left joins for DB query
  • orderby - orderby for DB query
  • distinct - distinct-flag for DB query
  • list_id - the list identifier
  • layout - custom renderer function (see S3DataList.render)
Returns:
tuple (S3DataList, numrows, ids), where numrows represents the total number of rows in the table that match the query

json(self, fields=None, start=0, limit=None, left=None, distinct=False, orderby=None)

source code 

Export a JSON representation of the resource.

Parameters:
  • fields - list of field selector strings
  • start - index of the first record
  • limit - maximum number of records
  • left - list of (additional) left joins
  • distinct - select only distinct rows
  • orderby - Orderby-expression for the query
Returns:
the JSON (as string), representing a list of dicts with {"tablename.fieldname":"value"}

load(self, fields=None, skip=None, start=None, limit=None, orderby=None, virtual=True, cacheable=False)

source code 

Loads records from the resource, applying the current filters, and stores them in the instance.

Parameters:
  • fields - list of field names to include
  • skip - list of field names to skip
  • start - the index of the first record to load
  • limit - the maximum number of records to load
  • orderby - orderby-expression for the query
  • virtual - whether to load virtual fields or not
  • cacheable - don't define Row actions like update_record or delete_record (faster, and the record can be cached)
Returns:
the records as list of Rows

clear(self)

source code 

Removes the records currently stored in this instance

records(self, fields=None)

source code 

Get the current set as Rows instance

Parameters:
  • fields - the fields to include (list of Fields)

__getitem__(self, key)
(Indexing operator)

source code 

Find a record currently stored in this instance by its record ID

Parameters:
  • key - the record ID
Returns:
a Row

__iter__(self)

source code 

Iterate over the records currently stored in this instance

get(self, key, component=None, link=None)

source code 

Get component records for a record currently stored in this instance.

Parameters:
  • key - the record ID
  • component - the name of the component
  • link - the name of the link table
Returns:
a Row (if component is None) or a list of rows

get_id(self)

source code 

Get the IDs of all records currently stored in this instance

get_uid(self)

source code 

Get the UUIDs of all records currently stored in this instance

__len__(self)
(Length operator)

source code 

The number of currently loaded rows

__repr__(self)
(Representation operator)

source code 

String representation of this resource

Overrides: object.__repr__

__contains__(self, item)
(In operator)

source code 

Tests whether this resource contains a (real) field.

Parameters:
  • item - the field selector or Field instance

__nonzero__(self)
(Boolean test operator)

source code 

Boolean test of this resource

export_xml(self, start=None, limit=None, msince=None, fields=None, dereference=True, maxdepth=MAXDEPTH, mcomponents=DEFAULT, rcomponents=None, references=None, mdata=False, stylesheet=None, as_tree=False, as_json=False, maxbounds=False, filters=None, pretty_print=False, location_data=None, map_data=None, target=None, **args)

source code 

Export this resource as S3XML

Parameters:
  • start - index of the first record to export (slicing)
  • limit - maximum number of records to export (slicing)
  • msince - export only records which have been modified after this datetime
  • fields - data fields to include (default: all)
  • dereference - include referenced resources
  • maxdepth - maximum depth for reference exports
  • mcomponents - components of the master resource to include (list of aliases), empty list for all available components
  • rcomponents - components of referenced resources to include (list of "tablename:alias")
  • references - foreign keys to include (default: all)
  • mdata - mobile data export (=>reduced field set, lookup-only option)
  • stylesheet - path to the XSLT stylesheet (if required)
  • as_tree - return the ElementTree (do not convert into string)
  • as_json - represent the XML tree as JSON
  • maxbounds - include lat/lon boundaries in the top level element (off by default)
  • filters - additional URL filters (Sync), as dict {tablename: {url_var: string}}
  • pretty_print - insert newlines/indentation in the output
  • location_data - dictionary of location data which has been looked-up in bulk ready for xml.gis_encode()
  • map_data - dictionary of options which can be read by the map
  • target - alias of component targetted (or None to target master resource)
  • args - dict of arguments to pass to the XSLT stylesheet

export_tree(self, start=0, limit=None, msince=None, fields=None, references=None, dereference=True, maxdepth=MAXDEPTH, mcomponents=None, rcomponents=None, filters=None, mdata=False, maxbounds=False, xmlformat=None, location_data=None, map_data=None, target=None)

source code 

Export the resource as element tree

Parameters:
  • start - index of the first record to export
  • limit - maximum number of records to export
  • msince - minimum modification date of the records
  • fields - data fields to include (default: all)
  • references - foreign keys to include (default: all)
  • dereference - also export referenced records
  • maxdepth
  • mcomponents - components of the master resource to include (list of tablenames), empty list for all
  • rcomponents - components of referenced resources to include (list of tablenames), empty list for all
  • filters - additional URL filters (Sync), as dict {tablename: {url_var: string}}
  • mdata - export is intended for mobile offline client (=>reduced field set, lookup-only option), overrides fields/references
  • maxbounds - include lat/lon boundaries in the top level element (off by default)
  • xmlformat
  • location_data - dictionary of location data which has been looked-up in bulk ready for xml.gis_encode()
  • target - alias of component targetted (or None to target master resource)
  • map_data - dictionary of options which can be read by the map

components_to_export(tablename, aliases)
Static Method

source code 

Get a list of aliases of components that shall be exported together with the master resource

Parameters:
  • tablename - the tablename of the master resource
  • aliases - the list of required components
Returns:
a list of component aliases

import_xml(self, source, files=None, id=None, format="xml", stylesheet=None, extra_data=None, ignore_errors=False, job_id=None, commit_job=True, delete_job=False, strategy=None, update_policy=None, conflict_policy=None, last_sync=None, onconflict=None, **args)

source code 

XML Importer

Parameters:
  • source - the data source, accepts source=xxx, source=[xxx, yyy, zzz] or source=[(resourcename1, xxx), (resourcename2, yyy)], where the xxx has to be either an ElementTree or a file-like object
  • files - attached files (None to read in the HTTP request)
  • id - ID (or list of IDs) of the record(s) to update (performs only update)
  • format - type of source = "xml", "json" or "csv"
  • stylesheet - stylesheet to use for transformation
  • extra_data - for CSV imports, dict of extra cols to add to each row
  • ignore_errors - skip invalid records silently
  • job_id - resume from previous import job_id
  • commit_job - commit the job to the database
  • delete_job - delete the import job from the queue
  • strategy - tuple of allowed import methods (create/update/delete)
  • update_policy - policy for updates (sync)
  • conflict_policy - policy for conflict resolution (sync)
  • last_sync - last synchronization datetime (sync)
  • onconflict - callback hook for conflict resolution (sync)
  • args - parameters to pass to the transformation stylesheet

import_tree(self, record_id, tree, job_id=None, ignore_errors=False, delete_job=False, commit_job=True, strategy=None, update_policy=None, conflict_policy=None, last_sync=None, onconflict=None)

source code 

Import data from an S3XML element tree.

Parameters:
  • record_id - record ID or list of record IDs to update
  • tree - the element tree
  • ignore_errors - continue at errors (=skip invalid elements)
  • job_id - restore a job from the job table (ID or UID)
  • delete_job - delete the import job from the job table
  • commit_job - commit the job (default)

To Do: update for link table support

export_options(self, component=None, fields=None, only_last=False, show_uids=False, hierarchy=False, as_json=False)

source code 

Export field options of this resource as element tree

Parameters:
  • component - name of the component which the options are requested of, None for the primary table
  • fields - list of names of fields for which the options are requested, None for all fields (which have options)
  • as_json - convert the output into JSON
  • only_last - obtain only the latest record

export_fields(self, component=None, as_json=False)

source code 

Export a list of fields in the resource as element tree

Parameters:
  • component - name of the component to lookup the fields (None for primary table)
  • as_json - convert the output XML into JSON

export_struct(self, meta=False, options=False, references=False, stylesheet=None, as_json=False, as_tree=False)

source code 

Get the structure of the resource

Parameters:
  • options - include option lists in option fields
  • references - include option lists even for reference fields
  • stylesheet - the stylesheet to use for transformation
  • as_json - convert into JSON after transformation

original(cls, table, record, mandatory=None)
Class Method

source code 

Find the original record for a possible duplicate:

  • if the record contains a UUID, then only that UUID is used to match the record with an existing DB record
  • otherwise, if the record contains some values for unique fields, all of them must match the same existing DB record
Parameters:
  • table - the table
  • record - the record as dict or S3XML Element

import_fields(table, data, mandatory=None)
Static Method

source code 

readable_fields(self, subset=None)

source code 

Get a list of all readable fields in the resource table

Parameters:
  • subset - list of fieldnames to limit the selection to

resolve_selectors(self, selectors, skip_components=False, extra_fields=True, show=True)

source code 

Resolve a list of field selectors against this resource

Parameters:
  • selectors - the field selectors
  • skip_components - skip fields in components
  • extra_fields - automatically add extra_fields of all virtual fields in this table
  • show - default for S3ResourceField.show
Returns:
tuple of (fields, joins, left, distinct)

resolve_selector(self, selector)

source code 

Wrapper for S3ResourceField, retained for backward compatibility

split_fields(self, skip=DEFAULT, data=None, references=None)

source code 

Split the readable fields in the resource table into reference and non-reference fields.

Parameters:
  • skip - list of field names to skip
  • data - data fields to include (None for all)
  • references - foreign key fields to include (None for all)

configure(self, **settings)

source code 

Update configuration settings for this resource

Parameters:
  • settings - configuration settings for this resource as keyword arguments

get_config(self, key, default=None)

source code 

Get a configuration setting for the current resource

Parameters:
  • key - the setting key
  • default - the default value to return if the setting is not configured for this resource

clear_config(self, *keys)

source code 

Clear configuration settings for this resource

Parameters:
  • keys - keys to remove (can be multiple)

Note: no keys specified removes all settings for this resource

limitby(self, start=0, limit=0)

source code 

Convert start+limit parameters into a limitby tuple

  • limit without start => start = 0
  • start without limit => limit = ROWSPERPAGE
  • limit 0 (or less) => limit = 1
  • start less than 0 => start = 0
Parameters:
  • start - index of the first record to select
  • limit - maximum number of records to select

get_join(self)

source code 

Get join for this component

get_left_join(self)

source code 

Get a left join for this component

link_id(self, master_id, component_id)

source code 

Helper method to find the link table entry ID for a pair of linked records.

Parameters:
  • master_id - the ID of the master record
  • component_id - the ID of the component record

component_id(self, master_id, link_id)

source code 

Helper method to find the component record ID for a particular link of a particular master record

Parameters:
  • link - the link (S3Resource)
  • master_id - the ID of the master record
  • link_id - the ID of the link table entry

update_link(self, master, record)

source code 

Create a new link in a link table if it doesn't yet exist. This function is meant to also update links in "embed" actuation mode once this gets implemented, therefore the method name "update_link".

Parameters:
  • master - the master record
  • record - the new component record to be linked

datatable_filter(self, fields, get_vars)

source code 

Parse datatable search/sort vars into a tuple of query, orderby and left joins

Parameters:
  • fields - list of field selectors representing the order of fields in the datatable (list_fields)
  • get_vars - the datatable GET vars
Returns:
tuple of (query, orderby, left joins)

axisfilter(self, axes)

source code 

Get all values for the given S3ResourceFields (axes) which match the resource query, used in pivot tables to filter out additional values where dimensions can have multiple values per record

Parameters:
  • axes - the axis fields as list/tuple of S3ResourceFields
Returns:
a dict with values per axis, only containes those axes which are affected by the resource filter

prefix_selector(self, selector)

source code 

Helper method to ensure consistent prefixing of field selectors

Parameters:
  • selector - the selector

list_fields(self, key="list_fields", id_column=0)

source code 

Get the list_fields for this resource

Parameters:
  • key - alternative key for the table configuration
  • id_column - - False to exclude the record ID
    • True to include it if it is configured
    • 0 to make it the first column regardless whether it is configured or not

get_defaults(self, master, defaults=None, data=None)

source code 

Get implicit defaults for new component records

Parameters:
  • master - the master record
  • defaults - any explicit defaults
  • data - any actual values for the new record
Returns:
a dict of {fieldname: values} with the defaults