Example #1
0
def import_profiles():
    for file_path in filter(lambda x: x.startswith('profile-'),
                            get_parquet_file_paths()):
        table = pq.read_table(file_path)
        df = table.to_pandas()
        for idx, row in df.iterrows():
            print(idx)
            p = Profile()
            p.id = row['id']
            p.created = row['created']
            p.updated = row['updated']
            p.city = row['city']
            p.first_name = row['first_name']
            p.last_name = row['last_name']
            p.headline = row['headline']
            p.state = row['state']
            p.summary = row['summary']
            session.add(p)
        session.commit()