[SIS-xxx] making quote attachment URL column larger

changing migration script for starboard/quotes
This commit is contained in:
Sheldan
2024-07-13 00:50:45 +02:00
parent af006ee880
commit dda7ed7db8
8 changed files with 51 additions and 21 deletions

View File

@@ -14,13 +14,17 @@ engine = db.create_engine('postgresql://%s:%s@%s:%s/%s' % (db_user, db_password,
with engine.connect() as con:
posts = load_all_starboard_posts(con)
print(posts)
print(f'Loaded {len(posts)}')
enriched_posts = enrich_posts(posts)
print(f'Enriched posts')
import_quotes(enriched_posts, con)
print(f'Done storing quotes')
con.commit()
fix_quote_created(enriched_posts, con)
con.commit()
print('Done.')
sub_posts = chunks = [posts[x:x+100] for x in range(0, len(posts), 100)]
print(f'Loaded {len(posts)} into {len(sub_posts)} partitions')
counter = 0
for sub_post in sub_posts:
print(f'Partition size {len(sub_post)}')
enriched_posts = enrich_posts(sub_post)
print(f'Enriched posts')
import_quotes(enriched_posts, con)
print(f'Done storing quotes')
con.commit()
fix_quote_created(enriched_posts, con)
con.commit()
counter += 1
print(f'Done. {counter}')