Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
Puchaczov authored Feb 7, 2024
1 parent 8ce3381 commit 4fb38c1
Showing 1 changed file with 24 additions and 12 deletions.
36 changes: 24 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,22 +62,34 @@ The engine is compatible with Linux, Windows, and Docker environments. It is als

## Query examples

#### Get only files that extension is `.png` or `.jpg`
#### Use GPT to compute sentiment on a comment

```sql
select
csv.PostId,
csv.Comment,
gpt.Sentiment(csv.Comment) as Sentiment,
csv.Date
from #separatedvalues.csv('/home/somebody/comments_sample.csv', true, 0) csv
inner join #openai.gpt('gpt-4-1106-preview') gpt on 1 = 1
```

#### Get only files that extension is `.png` or `.jpg`
```sql
SELECT
FullName
FROM #os.files('C:/Some/Path/To/Dir', true)
WHERE Extension = '.png' OR Extension = '.jpg'
```
#### equivalent with `in` operator:
```
```sql
SELECT
FullName
FROM #os.files('C:/Some/Path/To/Dir', true)
WHERE Extension IN ('.png', '.jpg')
```
#### group by directory and show size of each directories
```
```sql
SELECT
DirectoryName,
Sum(Length) / 1024 / 1024 as 'MB',
Expand All @@ -88,14 +100,14 @@ FROM #os.files('', true)
GROUP BY DirectoryName
```
#### try to find a file that has part `report` in his name:
```
```sql
SELECT
*
FROM #os.files('', true)
WHERE Name like '%report%'
```
#### try to find a file that has in it's title word that sounds like:
```
```sql
SELECT
FullName
FROM #os.files('E:/', true)
Expand All @@ -104,15 +116,15 @@ WHERE
HasWordThatSoundLike(Name, 'material')
```
#### get first, last 5 bits from files and consecutive 10 bytes of file with offset of 5 from tail
```
```sql
SELECT
ToHex(Head(5), '|'),
ToHex(Tail(5), '|'),
ToHex(GetFileBytes(10, 5), '|')
FROM #os.files('', false)
```
#### compare two directories
```
```sql
WITH filesOfA AS (
SELECT
GetRelativeName('E:\DiffDirsTests\A') AS FullName,
Expand Down Expand Up @@ -160,7 +172,7 @@ SELECT
FROM inDestinationDir inDest
```
#### which basically equivalent with build-in plugin is:
```
```sql
SELECT
(
CASE WHEN SourceFile IS NOT NULL
Expand All @@ -177,7 +189,7 @@ SELECT
FROM #os.dirscompare('E:\DiffDirsTests\A', 'E:\DiffDirsTests\B')
```
#### Look for directories contains zip files
```
```sql
SELECT
DirectoryName,
AggregateValues(Name)
Expand All @@ -186,14 +198,14 @@ WHERE IsZipArchive()
GROUP BY DirectoryName
```
#### Look for files greater than 1 gig
```
```sql
SELECT
FullName
FROM #os.files('', true)
WHERE ToDecimal(Length) / 1024 / 1024 / 1024 > 1
```
#### Tries to read the text from `.png` file through OCR plugin.
```
```sql
SELECT
ocr.GetText(file.FullName) as text
FROM
Expand All @@ -204,7 +216,7 @@ ON 1 = 1
WHERE files.Extension = '.png'
```
#### Prints the values from 1 to 9
```
```sql
SELECT Value FROM #system.range(1, 10)
```

Expand Down

0 comments on commit 4fb38c1

Please sign in to comment.