1
- # SPDX-FileCopyrightText: 2015 Sebastian Wagner, 2023 CERT.at GmbH
1
+ # SPDX-FileCopyrightText: 2015-2021 nic.at GmbH, 2022 Sebastian Wagner, 2023 CERT.at GmbH, 2025 Institute for Common Good Technology
2
2
#
3
3
# SPDX-License-Identifier: AGPL-3.0-or-later
4
4
@@ -133,7 +133,7 @@ def _generate_separated_raws_schema(fields: dict, partition_key: str) -> list:
133
133
134
134
def generate (harmonization_file = HARMONIZATION_CONF_FILE , skip_events = False ,
135
135
separate_raws = False , partition_key = None , skip_or_replace = False ,
136
- use_jsonb = False ):
136
+ no_jsonb = False ):
137
137
FIELDS = {}
138
138
sql_lines = []
139
139
@@ -171,7 +171,7 @@ def generate(harmonization_file=HARMONIZATION_CONF_FILE, skip_events=False,
171
171
elif value ['type' ] == 'UUID' :
172
172
dbtype = 'UUID'
173
173
elif value ['type' ] in ('JSON' , 'JSONDict' ):
174
- dbtype = 'jsonb ' if use_jsonb else 'json '
174
+ dbtype = 'json ' if no_jsonb else 'jsonb '
175
175
else :
176
176
raise ValueError ('Unknown type %r.' % value ['type' ])
177
177
@@ -213,8 +213,8 @@ def main():
213
213
help = "Path to the harmonization file" )
214
214
parser .add_argument ("--skip-or-replace" , default = False , action = "store_true" ,
215
215
help = "Add IF NOT EXISTS or REPLACE directive to created schemas" )
216
- parser .add_argument ("--jsonb" , default = False , action = "store_true" ,
217
- help = "Use JSONB type to represent dictionary fields" )
216
+ parser .add_argument ("--no- jsonb" , default = True , action = "store_true" ,
217
+ help = "Do not use JSONB but JSON type to represent dictionary fields" )
218
218
args = parser .parse_args ()
219
219
220
220
OUTPUTFILE = args .outputfile
@@ -232,7 +232,7 @@ def main():
232
232
separate_raws = args .separate_raws ,
233
233
partition_key = args .partition_key ,
234
234
skip_or_replace = args .skip_or_replace ,
235
- use_jsonb = args .jsonb ,
235
+ no_jsonb = args .no_jsonb ,
236
236
)
237
237
print ("INFO - Writing %s file" % OUTPUTFILE )
238
238
fp .write (psql )
0 commit comments