feeder: store truncated temp schema's name (#50835)

This commit is contained in:
Benjamin Dauvergne 2021-02-04 10:35:24 +01:00
parent 1d35d39f6f
commit dc36901dde
1 changed files with 4 additions and 3 deletions

View File

@ -96,11 +96,12 @@ class WcsOlapFeeder(object):
if len(schema) > 63:
raise ValueError('schema name length must < 64 characters: %r' % schema)
self.schema = schema
self.schema_temp = truncate_pg_identifier(schema + '_temp')
self.do_feed = do_feed
self.ctx = Context()
self.ctx.push({
'schema': self.schema,
'schema_temp': truncate_pg_identifier(schema + '_temp'),
'schema_temp': self.schema_temp,
'role_table': 'role',
'channel_table': 'channel',
'category_table': 'category',
@ -335,8 +336,8 @@ class WcsOlapFeeder(object):
def do_schema(self):
self.ex('SET search_path = public')
self.logger.debug('dropping schema %s', self.schema + '_temp')
self.drop_tables_sequencially(self.schema + '_temp')
self.logger.debug('dropping schema %s', self.schema_temp)
self.drop_tables_sequencially(self.schema_temp)
self.ex('DROP SCHEMA IF EXISTS {schema_temp} CASCADE')
self.logger.debug('creating schema %s', self.schema)
self.ex('CREATE SCHEMA {schema_temp}')