Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • C csvkit
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 61
    • Issues 61
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 4
    • Merge requests 4
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • wireservice
  • csvkit
  • Issues
  • #299
Closed
Open
Issue created Aug 02, 2014 by Administrator@rootContributor

csvsql --insert fails with null violation when there are no data rows

Created by: srstsavage

Using Postgres (surely other dbs too), running an insert command like the following

csvsql --db postgresql://user:pass@server/database --insert data.csv

using a CSV file with only header data and no data rows

hi,no_data_here

results in a NOT NULL violation (some sort of insert is apparently attempted by csvsql even though there are zero rows).

csvsql should check to see if there's any data to insert before trying. Obviously the user can leave off the --insert flag and just create the schema, but that doesn't work if you're running csvsql on a bunch of CSV files using a wildcard, some of which have data and some only header info.

Assignee
Assign to
Time tracking