H2数据库可以查询包含不同记录组的多个部分的CSV文件吗? [英] Can H2 Database query a CSV file containing multiple sections of different record groups?

查看:151
本文介绍了H2数据库可以查询包含不同记录组的多个部分的CSV文件吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我以CSV(种类)格式接收数据,其中每个实体由不同记录组的多个部分表示。在这个虚构的例子(下面)中,我由不同记录组的多个部分(这些可以被认为是表)来表示多个学院(实体)。我无法控制此传入数据的格式。所以我想知道,当使用H2数据库引擎对传入的CSV数据发出查询时,您可以通过某种模式指定哪个行开始,以识别给定实体的每个表的第一行吗?虚拟数据如下。

I receive data in a CSV (kind of) format, in which each entity is represented by multiple sections of different record groups. In this fictitious example (below) I represent a number of colleges (the entities) by a number of sections of different record groups (these can be thought of as the tables). I have no control over the format of this incoming data. So I was wondering, when issueing a query on incoming CSV data using the H2 Database engine, can you somehow specify which line to begin at based on some kind of pattern to identify the first line of each table for a given entity? The fictitious data is below.

NEWCOLLEGE

ADDRESS|HOUSE_NO|STREET|TOWN|CITY|COUNTY|COUNTRY
DATA|51|Hill Road|Reading|Berkshire|United Kingdom
DATA|78|Crescent Road|Wallingford|Oxfordshire|United Kingdom
DATA|5|Bonny Crescent|Swindon|Whiltshire|United Kingdom

COURSES|NAME|DESCRIPTION|CODE
DATA|Sketching Life|Sketching from live examples|434
DATA|Gardening|Teaching how to plant a variety of shrubs|546

KEYDATA|COLLEGE NAME|DEPARTMENT
DATA|Witney College|Life Skills

LECTURERS|NAME|COURSE|EMP_ID|DATE_OF_BIRTH
DATA|David Kew|Sketching|3434535|03-04-1951
DATA|Mary Coldridge|Gardening|5352346|15-04-1969
DATA|Henry Cunnings|IT Basics|4354364|12-12-1971

NEWCOLLEGE

.... and some more tables for another college


推荐答案

目前这是不可能开箱即用的。数据需要预处理(分割成多个文件)。

Currently this is not possible out of the box. The data would need to be pre-processed (split into multiple files).

这篇关于H2数据库可以查询包含不同记录组的多个部分的CSV文件吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆