33
33
is_attachment = False ,
34
34
is_filepath = False ,
35
35
is_external = False ,
36
+ is_hidden = False ,
36
37
adapter = None ,
37
38
store = None ,
38
39
unsupported = False ,
@@ -124,32 +125,37 @@ def attributes(self):
124
125
125
126
@property
126
127
def names (self ):
127
- return [k for k in self .attributes ]
128
+ return [k for k in self .attributes if not self . attributes [ k ]. is_hidden ]
128
129
129
130
@property
130
131
def primary_key (self ):
131
- return [k for k , v in self .attributes .items () if v .in_key ]
132
+ return [k for k , v in self .attributes .items () if v .in_key and not v . is_hidden ]
132
133
133
134
@property
134
135
def secondary_attributes (self ):
135
- return [k for k , v in self .attributes .items () if not v .in_key ]
136
+ return [
137
+ k for k , v in self .attributes .items () if not v .in_key and not v .is_hidden
138
+ ]
136
139
137
140
@property
138
141
def blobs (self ):
139
- return [k for k , v in self .attributes .items () if v .is_blob ]
142
+ return [k for k , v in self .attributes .items () if v .is_blob and not v . is_hidden ]
140
143
141
144
@property
142
145
def non_blobs (self ):
143
146
return [
144
147
k
145
148
for k , v in self .attributes .items ()
146
149
if not (v .is_blob or v .is_attachment or v .is_filepath or v .json )
150
+ and not v .is_hidden
147
151
]
148
152
149
153
@property
150
154
def new_attributes (self ):
151
155
return [
152
- k for k , v in self .attributes .items () if v .attribute_expression is not None
156
+ k
157
+ for k , v in self .attributes .items ()
158
+ if v .attribute_expression is not None and not v .is_hidden
153
159
]
154
160
155
161
def __getitem__ (self , name ):
@@ -165,6 +171,8 @@ def __repr__(self):
165
171
if self ._table_status is not None :
166
172
ret += "# " + self .table_status ["comment" ] + "\n "
167
173
for v in self .attributes .values ():
174
+ if v .is_hidden :
175
+ continue
168
176
if in_key and not v .in_key :
169
177
ret += "---\n "
170
178
in_key = False
@@ -298,6 +306,7 @@ def _init_from_database(self):
298
306
store = None ,
299
307
is_external = False ,
300
308
attribute_expression = None ,
309
+ is_hidden = attr ["name" ].startswith ("_" ),
301
310
)
302
311
303
312
if any (TYPE_PATTERN [t ].match (attr ["type" ]) for t in ("INTEGER" , "FLOAT" )):
0 commit comments