def dump(self, output_stream): stats = Counter() objects = get_objects_to_dump(self.domain, self.excludes, stats_counter=stats, stdout=self.stdout) JsonLinesSerializer().serialize( objects, use_natural_foreign_keys=False, use_natural_primary_keys=True, stream=output_stream ) return stats
def dump_sql_data(domain, excludes, output_stream): """ Dump SQL data for domain to stream. :param domain: Name of domain to dump data for :param excludes: List of app labels ("app_label.model_name" or "app_label") to exclude :param output_stream: Stream to write json encoded objects to """ objects = get_objects_to_dump(domain, excludes) JsonLinesSerializer().serialize(objects, use_natural_foreign_keys=False, use_natural_primary_keys=False, stream=output_stream)