blaze / blaze/odo

Take care of fields with AUTOINCREMENT

Open
#39 0 comments 2 reactions 1 assignee Claimed by @cpcloud View on GitHub
Dominant language
Python
Stars
1k
Forks
131
PR merge metrics
No merged PRs in 30d

Description

Sometimes fields in tables were created with the AUTOINCREMENT command.
`into` should ignore this column and (let sqlalchemy) take care of this field when a user inserts data that does not have this field defined.

``` py
import os
import sqlite3
import pandas as pd
import numpy as np
from blaze import *

DB = 'test.db'
TABLE = 'position'

try:
os.remove(DB)
except OSError:
pass

conn = sqlite3.connect(DB)
conn.execute(
'''CREATE TABLE {} (
id integer NOT NULL PRIMARY KEY AUTOINCREMENT,
x real NOT NULL,
y real NOT NULL,
z real NOT NULL
)'''.format(TABLE)
)
conn.close()

positions = pd.DataFrame(np.random.randn(10, 3), columns=['x', 'y', 'z'])

table_url = 'sqlite:///' + DB + '::' + TABLE

into(table_url, positions)
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.