/
meta.txt
116 lines (70 loc) · 2.96 KB
/
meta.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
=====================
Meta class reference
=====================
.. currentmodule:: data-migrator.models
This document covers features of the :class:`~data-migrator.models.Meta` class. The meta class
defines model specific settings.
.. note::
Technically, Meta is just a container and forwarded to :class:`data-migrator.models.options.Options`
Field options
=============
The following arguments are available to all field types. All are optional.
``drop_if_none``
----------------
.. attribute:: Meta.drop_if_none
Is a list of field names as defined. If set `data-migrator` will check if fields are not None
and drop if one of the columns is.
Any field listed in this attribute is checked after scanning and just before save-ing.
.. note::
Note that only NullXXXFields actually can be ``None`` after scanning and parsing. Non
Null fields are set to their default value.
``drop_non_unique``
-------------------
.. attribute:: Meta.drop_non_unique
If ``True``, `data-migrator` will drop values if the column uniqueness check fails
(after parsing). Default is ``False``.
Any field can be defined as a unique column. Any field set so, is checked after
scanning and just before save-ing.
``emitter``
-----------
.. attribute:: Meta.emitter
If set, `data-migrator` will use this emitter instead of the default emitter.
``fail_non_unique``
-------------------
.. attribute:: Meta.fail_non_unique
If ``True``, `data-migrator` will fail as a whole if the column uniqueness check fails
(after parsing). Default is ``False``.
Any field can be defined as a unique column. Any field set so, is checked after
scanning and just before save-ing.
``fail_non_validated``
----------------------
.. attribute:: Meta.fail_non_validated
If ``True``, `data-migrator` will fail as a whole if the column validation check fails
(after parsing). Default is ``False``.
Any field can have its own validator, this is a rough method to prevent bad data from
being transformed and loaded.
``file_name``
-------------
.. attribute:: Meta.file_name
If set, `data-migrator` will use this as file_name for the emitter instead of the default
filename based on table_name.
``table_name``
--------------
.. attribute:: Meta.table_name
If set, `data-migrator` will use this as table_name for the emitter instead of the default
tablename based on model_name.
``prefix``
----------
.. attribute:: Meta.prefix
If set, `data-migrator` will use this list of statements as a preamble in the generation of
the output statements. By default an emitter uses this to clear the old records.
``remark``
----------
.. attribute:: Meta.remark
If set, `data-migrator` will use this as the remark attribute in the Model, default='remark'.
Use this for example if you have a ``remark`` field in your model and need to free the keyword.
``manager``
-----------
.. attribute:: Meta.manager
If set, `data-migrator` will use this as the manager for this model. This is useful if
the ``transform`` method needs to be overridden.