# Create dataset for file/folder using JDBC?

**URL:** <https://community.dremio.com/t/create-dataset-for-file-folder-using-jdbc/9044>\
**Category:** Dremio University\
**Created:** [April 12, 2022, 8:27pm UTC](https://community.dremio.com/t/create-dataset-for-file-folder-using-jdbc/9044 "2022-04-12T20:27:36Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![harindersb](https://avatars.discourse-cdn.com/v4/letter/h/a3d4f5/32.png) [@harindersb](https://community.dremio.com/u/harindersb)\
**Post date:** [April 12, 2022, 8:27pm UTC](https://community.dremio.com/t/create-dataset-for-file-folder-using-jdbc/9044/1 "2022-04-12T20:27:36Z")

</div>

Hi, Is there a way I can create a physical dataset for a file/folder using JDBC? I have been creating dataset for a file on S3 in Dremio using REST API and Dremio UI but wanted to know if there is a way of doing this via JDBC as well? Wanted to do this in case a user only has a JDBC client to work with Dremio and wants to work with files in say S3 or any filesystem so are there any options for that? Or creating a PDS using REST or UI needs to be done first.

Example of what I am doing using REST is below:

{  
“entityType”: “dataset”,  
“id”: “dremio%3A%2FSamples%[2Fsamples.dremio.com](http://2Fsamples.dremio.com)%2FDremio%20University%vendor\_lookup.csv”,  
“path”: [  
“Samples”,  
“[samples.dremio.com](http://samples.dremio.com)”,  
“Dremio University”,  
“vendor\_lookup.csv”  
],  
“type”: “PHYSICAL\_DATASET”,  
“format”: {  
“type”: “Text”,  
“fieldDelimiter”: “,”,  
“lineDelimiter”: “\r\n”,  
“escape”: “”",  
“quote”: “”",  
“skipFirstLine”: false,  
“extractHeader”: true,  
“trimHeader”: true,  
“autoGenerateColumnNames”: false  
}  
}

---

<div class="post-metadata">

**Author:** ![lenoyjacob](https://sea2.discourse-cdn.com/flex020/user_avatar/community.dremio.com/lenoyjacob/32/3474_2.png) [@lenoyjacob](https://community.dremio.com/u/lenoyjacob)\
**Post date:** [April 12, 2022, 10:03pm UTC](https://community.dremio.com/t/create-dataset-for-file-folder-using-jdbc/9044/2 "2022-04-12T22:03:11Z")

</div>

@harindersb You should be able to use the “automatically format files” option in the source settings.

Like so:  
 ![Metadata](https://us1.discourse-cdn.com/flex020/uploads/dremio/original/2X/9/96e704ce733d83ad80406c24b98e2072762ac371.gif)

---

<div class="post-metadata">

**Author:** ![harindersb](https://avatars.discourse-cdn.com/v4/letter/h/a3d4f5/32.png) [@harindersb](https://community.dremio.com/u/harindersb)\
**Post date:** [April 12, 2022, 10:33pm UTC](https://community.dremio.com/t/create-dataset-for-file-folder-using-jdbc/9044/3 "2022-04-12T22:33:09Z")

</div>

Thanks @lenoyjacob . I tried it out and works wells for the example you gave of Parquet file but is there a way to specify the format for files like CSV like I am doing in the above REST call example? On such files it puts everything in one column and to handle such cases one would like to supply the format options like fieldDelimiter, lineDelimiter etc.

---

<div class="post-metadata">

**Author:** ![lenoyjacob](https://sea2.discourse-cdn.com/flex020/user_avatar/community.dremio.com/lenoyjacob/32/3474_2.png) [@lenoyjacob](https://community.dremio.com/u/lenoyjacob)\
**Post date:** [April 13, 2022, 4:57am UTC](https://community.dremio.com/t/create-dataset-for-file-folder-using-jdbc/9044/4 "2022-04-13T04:57:46Z")

</div>

Interesting. I think one way is to do something like:

```auto
SELECT * FROM TABLE(Samples."samples.dremio.com"."Dremio University"."vendor_lookup.csv" (type => 'text', fieldDelimiter => ',', lineDelimiter => '
', extractHeader => true))

```

(The query is intentionally in two different lines)

 ![image](https://us1.discourse-cdn.com/flex020/uploads/dremio/original/2X/3/3ec906df243ab90c782013fde97f37c476969f14.png)

But I guess that doesn’t really promote the dataset. Others may have a better way?

---

<div class="post-metadata">

**Author:** ![balaji.ramaswamy](https://sea2.discourse-cdn.com/flex020/user_avatar/community.dremio.com/balaji.ramaswamy/32/843_2.png) [@balaji.ramaswamy](https://community.dremio.com/u/balaji.ramaswamy)\
**Post date:** [April 13, 2022, 7:14am UTC](https://community.dremio.com/t/create-dataset-for-file-folder-using-jdbc/9044/5 "2022-04-13T07:14:38Z")

</div>

@harindersb Auto promotion of CSV files when the options like line/field delimiters are different is not possible as when we auto promote CSV’s it ill promote with the default settings,

---

<div class="post-metadata">

**Author:** ![harindersb](https://avatars.discourse-cdn.com/v4/letter/h/a3d4f5/32.png) [@harindersb](https://community.dremio.com/u/harindersb)\
**Post date:** [April 13, 2022, 6:54pm UTC](https://community.dremio.com/t/create-dataset-for-file-folder-using-jdbc/9044/6 "2022-04-13T18:54:14Z")

</div>

Yeah, but this is good to know. Thanks!

---

<div class="post-metadata">

**Author:** ![harindersb](https://avatars.discourse-cdn.com/v4/letter/h/a3d4f5/32.png) [@harindersb](https://community.dremio.com/u/harindersb)\
**Post date:** [April 13, 2022, 6:54pm UTC](https://community.dremio.com/t/create-dataset-for-file-folder-using-jdbc/9044/7 "2022-04-13T18:54:56Z")

</div>

Got it. Thanks @balaji.ramaswamy
