Re: FTS trigger works 1 at a time, but fails with bulk insert script

From: Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com>
To: Malik Rumi <malik(dot)a(dot)rumi(at)gmail(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: FTS trigger works 1 at a time, but fails with bulk insert script
Date: 2018-10-08 23:36:53
Message-ID: 227ced50-8bb3-99b6-ce4d-77b97d396fdc@aklaver.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 10/8/18 3:54 PM, Adrian Klaver wrote:
> On 10/8/18 1:58 PM, Malik Rumi wrote:
>> So what is the script you used to do the bulk INSERT?
>>
>> There's actually three, but they are all basically the same. The
>> differences have to do with the source material being inserted:
>>
>> # usr/local/bin/python3.6
>> # coding: utf-8
>>
>> from os import environ
>> environ['DJANGO_SETTINGS_MODULE'] = 'chronicle.settings'
>> import django
>> django.setup()
>> from ktab.models import Entry, Tag
>
> So I am going to assume Entry and Tag map to the tables ktab_entry and
> public.ktab_entry_tags respectively.
>
>> from django.utils.text import slugify
>> import csv
>>
>>
>> filename = '/home/malikarumi/Projects/Progress_Logs/edit_blogpost.csv'
>>
>> with open(filename, 'rt') as text:
>>      reader = csv.DictReader(text, delimiter=',')
>>      # next(reader, None)
>>      for row in reader:
>>          my_entry = Entry.objects.create(
>>              title=row['title'], slug=row['slug'],
>> chron_date=row['created'],
>>              clock=row['clock'], content=row['content'])
>>          my_entry.tags.add(row['tag'])
>
> I thought that you needed to pass a model object to add(). If I am
> following the above it is just a csv field value.
>
> Assuming log_statement = 'mod', I would tail the postgresql.conf file to
> see what is actually hitting the database.

Aargh, meant tail the Postgres log file.

>
>
>
>> */“None of you has faith until he loves for his brother or his
>> neighbor what he loves for himself.”/*
>>
>>
>
>
>

--
Adrian Klaver
adrian(dot)klaver(at)aklaver(dot)com

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Michael Paquier 2018-10-09 02:45:04 Re: pg9.6: no backup history file (*.backup) created on hot standby
Previous Message Adrian Klaver 2018-10-08 22:54:03 Re: FTS trigger works 1 at a time, but fails with bulk insert script