Projet

Général

Profil

0001-feeder-write-new-model-file-after-schema-renaming-42.patch

Serghei Mihai, 11 janvier 2021 14:33

Télécharger (1,74 ko)

Voir les différences:

Subject: [PATCH] feeder: write new model file after schema renaming (#42320)

 wcs_olap/feeder.py | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)
wcs_olap/feeder.py
572 572
                    formdef_feeder.feed()
573 573
                except WcsApiError as e:
574 574
                    self.logger.error('failed to retrieve formdef %s, %s', formdef.slug, e)
575
            if 'cubes_model_dirs' in self.config:
576
                model_path = os.path.join(self.config['cubes_model_dirs'], '%s.model' % self.schema)
577
                with open(model_path, 'w') as f:
578
                    json.dump(self.model, f, indent=2, sort_keys=True)
579 575
        except Exception:
580 576
            # keep temporary schema alive for debugging
581 577
            raise
......
587 583
                    self.ex('DROP SCHEMA IF EXISTS {schema} CASCADE')
588 584
                    self.logger.debug('renaming schema %s to %s', self.schema + '_temp', self.schema)
589 585
                    self.ex('ALTER SCHEMA {schema_temp} RENAME TO {schema}')
586

  
587
                    if 'cubes_model_dirs' in self.config:
588
                        model_path = os.path.join(self.config['cubes_model_dirs'], '%s.model' % self.schema)
589
                        with open(model_path, 'w') as f:
590
                            json.dump(self.model, f, indent=2, sort_keys=True)
590 591
        finally:
591 592
            # prevent connection from remaining open
592 593
            self.cur.close()
593
-