pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Adrian Klaver <adrian.klaver@aklaver.com>
To: Malik Rumi <malik.a.rumi@gmail.com>
Cc: pgsql-general@postgresql.org
Subject: Re: FTS trigger works 1 at a time, but fails with bulk insert script
Date: Mon, 8 Oct 2018 16:36:53 -0700
Message-ID: <227ced50-8bb3-99b6-ce4d-77b97d396fdc@aklaver.com> (raw)
In-Reply-To: <90aa688d-0e38-1f7e-f863-5a8d58fa4850@aklaver.com>
References: <CAKd6oBwLXpBU4sJwAokp_1gkhO38gYW__HpRtGWfWLcEOpT1MQ@mail.gmail.com>
	<ff45112f-48a7-3384-7b5c-18f31ef5e5e0@aklaver.com>
	<CAKd6oByX51Y4EzHKVdLESxViLssiqvK6HZvN8rK=31ksptTg6Q@mail.gmail.com>
	<d5314372-76bc-6f7b-2be7-21d6cd09cf06@aklaver.com>
	<CAKd6oBwG0eAAg3CvpjrbuUdhtZu8WBHwmJ2ED_hKadZmAb7i=g@mail.gmail.com>
	<a8981642-a559-68a8-bdb3-0fa43e1c4562@aklaver.com>
	<CAKd6oBy1B8Q-6JXSRf0wZZA2-oHoLAQJyxHLyuE5UKhGb0HtkA@mail.gmail.com>
	<90aa688d-0e38-1f7e-f863-5a8d58fa4850@aklaver.com>

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.klaver@aklaver.com




view thread (11+ messages)  latest in thread

Message-ID: <227ced50-8bb3-99b6-ce4d-77b97d396fdc@aklaver.com>
Permalink:  ../227ced50-8bb3-99b6-ce4d-77b97d396fdc@aklaver.com/
Also on:    postgresql.org/message-id/227ced50-8bb3-99b6-ce4d-77b97d396fdc@aklaver.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-general@postgresql.org
  Cc: adrian.klaver@aklaver.com, malik.a.rumi@gmail.com
  Subject: Re: FTS trigger works 1 at a time, but fails with bulk insert script
  In-Reply-To: <227ced50-8bb3-99b6-ce4d-77b97d396fdc@aklaver.com>
  References: <CAKd6oBwLXpBU4sJwAokp_1gkhO38gYW__HpRtGWfWLcEOpT1MQ@mail.gmail.com> <ff45112f-48a7-3384-7b5c-18f31ef5e5e0@aklaver.com> <CAKd6oByX51Y4EzHKVdLESxViLssiqvK6HZvN8rK=31ksptTg6Q@mail.gmail.com> <d5314372-76bc-6f7b-2be7-21d6cd09cf06@aklaver.com> <CAKd6oBwG0eAAg3CvpjrbuUdhtZu8WBHwmJ2ED_hKadZmAb7i=g@mail.gmail.com> <a8981642-a559-68a8-bdb3-0fa43e1c4562@aklaver.com> <CAKd6oBy1B8Q-6JXSRf0wZZA2-oHoLAQJyxHLyuE5UKhGb0HtkA@mail.gmail.com> <90aa688d-0e38-1f7e-f863-5a8d58fa4850@aklaver.com> <227ced50-8bb3-99b6-ce4d-77b97d396fdc@aklaver.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox