# Discourse Data Explorer와 Power BI 통합

**URL:** https://meta.discourse.org/t/discourse-data-explorer-power-bi-integration/159577
**Category:** Administrators
**Tags:** tutorial, platforms
**Created:** [8월 2, 2020, 12:44오후 UTC](https://meta.discourse.org/t/discourse-data-explorer-power-bi-integration/159577 "2020-08-02T12:44:18Z")
**Posts on this page:** 1
**Showing post:** 11

<div class="post-metadata">

### Author: ![loginerror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/loginerror/32/156605_2.png) [@loginerror](https://meta.discourse.org/u/loginerror)
#### Post date: [3월 11, 2021, 8:27오전 UTC](https://meta.discourse.org/t/discourse-data-explorer-power-bi-integration/159577/11 "2021-03-11T08:27:32Z")

</div>

첫 번째 게시글의 스크립트를 개선하려는 분이 계실 수 있으니 간단한 업데이트를 공유합니다.

사실 데이터 양과 무관하게 한 번에 모든 데이터를 가져오는 것이 가능한 것 같습니다. 😅  
(상당한 크기의 `posts` 테이블(id 및 raw 컬럼 포함)에서 스트레스 테스트를 해보았는데 성공적이었습니다!)

샘플 쿼리:

```plaintext
SELECT 'id'
            || string_agg(E'\n' || case when posts.id::text is null then '-1' else posts.id::text end
            ,''
            ORDER BY posts.id asc) as value
FROM posts

```

이 쿼리를 실행하면 거의 CSV 형식의 파일이 하나의 값으로, 즉 한 페이지에 출력됩니다. 이때 `value"` 부분과 끝의 `"`을 제거하면 유용한 CSV 파일이 됩니다.

 ![image](https://global.discourse-cdn.com/meta/original/3X/8/a/8a37c69ec8fba54be7499a5f30530edf1213ce35.png)

물론 CSV 파일에 새로운 컬럼을 추가하고 해당 컬럼에 대한 데이터를 추가함으로써 더 많은 데이터를 포함시킬 수 있습니다:

```plaintext
SELECT 'id,newcolumn'
            || string_agg(E'\n' || case when posts.id::text is null then '-1' else posts.id::text end
            || string_agg(E'\n' || case when posts.newcolumn::text is null then '-1' else posts.newcolumn::text end
            ,''
            ORDER BY posts.id asc) as value
FROM posts

```

이러한 쿼리를 지원하도록 업데이트하면 Power BI가 여러 페이지를 탐색할 필요가 없어져 데이터 검색 속도가 빨라집니다.

---

_[View the full topic](https://meta.discourse.org/t/discourse-data-explorer-power-bi-integration/159577)._
