home / github / issue_comments

Menu
  • Search all tables
  • GraphQL API

issue_comments: 482994231

This data as json

html_url issue_url id node_id user created_at updated_at author_association body reactions issue performed_via_github_app
https://github.com/simonw/sqlite-utils/issues/8#issuecomment-482994231 https://api.github.com/repos/simonw/sqlite-utils/issues/8 482994231 MDEyOklzc3VlQ29tbWVudDQ4Mjk5NDIzMQ== 82988 2019-04-14T15:04:07Z 2019-04-14T15:29:33Z NONE

PLEASE IGNORE THE BELOW... I did a package update and rebuilt the kernel I was working in... may just have been an old version of sqlite_utils, seems to be working now. (Too many containers / too many environments!)

Has an issue been reintroduced here with FTS? eg I'm getting an error thrown by spaces in column names here:

``` /usr/local/lib/python3.7/site-packages/sqlite_utils/db.py in insert_all(self, records, pk, foreign_keys, upsert, batch_size, column_order)

def enable_fts(self, columns, fts_version="FTS5"): --> 329 "Enables FTS on the specified columns" 330 sql = """ 331 CREATE VIRTUAL TABLE "{table}_fts" USING {fts_version} ( ```

when trying an insert_all.

Also, if a col has a . in it, I seem to get:

``` /usr/local/lib/python3.7/site-packages/sqlite_utils/db.py in insert_all(self, records, pk, foreign_keys, upsert, batch_size, column_order) 327 jsonify_if_needed(record.get(key, None)) for key in all_columns 328 ) --> 329 result = self.db.conn.execute(sql, values) 330 self.db.conn.commit() 331 self.last_id = result.lastrowid

OperationalError: near ".": syntax error ```

(Can't post a worked minimal example right now; racing trying to build something against a live timing screen that will stop until next weekend in an hour or two...)

PS Hmmm I did a test and they seem to work; I must be messing up s/where else...

``` import sqlite3 from sqlite_utils import Database

dbname='testingDB_sqlite_utils.db'

!rm $dbname

conn = sqlite3.connect(dbname, timeout=10)

Setup database tables

c = conn.cursor()

setup=''' CREATE TABLE IF NOT EXISTS "test1" ( "NO" INTEGER, "NAME" TEXT );

CREATE TABLE IF NOT EXISTS "test2" ( "NO" INTEGER, TIME OF DAY TEXT );

CREATE TABLE IF NOT EXISTS "test3" ( "NO" INTEGER, AVG. SPEED (MPH) FLOAT ); '''

c.executescript(setup)

DB = Database(conn)

import pandas as pd

df1 = pd.DataFrame({'NO':[1,2],'NAME':['a','b']}) DB['test1'].insert_all(df1.to_dict(orient='records'))

df2 = pd.DataFrame({'NO':[1,2],'TIME OF DAY':['early on','late']}) DB['test2'].insert_all(df2.to_dict(orient='records'))

df3 = pd.DataFrame({'NO':[1,2],'AVG. SPEED (MPH)':['123.3','123.4']}) DB['test3'].insert_all(df3.to_dict(orient='records')) ```

all seem to work ok. I'm still getting errors in my set up though, which is not too different to the text cases?

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
403922644  
Powered by Datasette · Queries took 1.078ms · About: github-to-sqlite