null로 써있는 것을 DB에 끌어갈때는 NULL로 인식시킨다고 하는데 해보긴 해야겠네..

 

 copy r from '/home/y.csv' delimiter ',' csv NULL AS 'null';

[링크 : https://stackoverflow.com/questions/19034674/copy-null-values-present-in-csv-file-to-postgres]

Posted by 구차니

2.14.0 쓰고 있었는데

2.15.x 부터 3-way diff를 지원한다고 한다.

이제.. kdiff3 안써도 되겠다 +_+!

[링크 : https://winmerge.org/docs/releasenotes.php]

Posted by 구차니
Programming/xml2019. 9. 11. 13:55

값이 설정 안되어 있으면 기본 값은 minOccurs=1, maxOccurs=1 로 된다고 한다.

 

[링크 : http://tcpschool.com/xml/xml_xsd_occurrenceIndicator]

[링크 : https://stackoverflow.com/questions/4821477/xml-schema-minoccurs-maxoccurs-default-values]

'Programming > xml' 카테고리의 다른 글

xpath exist boolean()  (0) 2019.09.29
xpath 복수개의 attribute 동시에 만족하는 항목 찾기  (0) 2019.09.14
xpath count()  (0) 2019.09.09
xpath xsi  (0) 2019.08.12
xpath concat  (0) 2019.08.08
Posted by 구차니
Programming/node.js2019. 9. 10. 12:45

sprintf() 처럼 %d로 치환해서 출력가능한 모듈이 util.format()으로 존재한다.

 

[링크 : https://nodejs.org/api/util.html#util_util_format_format_args]

'Programming > node.js' 카테고리의 다른 글

json2csv / node.js 에서 NULL 값 출력하기  (0) 2019.09.18
js nested function과 변수 scope  (0) 2019.09.15
node.js xpath 지원함수 목록  (0) 2019.09.10
node.js csv2json  (0) 2019.08.21
node.js regex  (0) 2019.08.12
Posted by 구차니
Programming/node.js2019. 9. 10. 10:24

count()가 잘 안되서 지원이 안되는건줄 알았는데 엉뚱한 경로를 해놓고 헤매고 있었다..

FunctionResolver.prototype.addStandardFunctions = function() {
this.functions["{}last"] = Functions.last;
this.functions["{}position"] = Functions.position;
this.functions["{}count"] = Functions.count;
this.functions["{}id"] = Functions.id;
this.functions["{}local-name"] = Functions.localName;
this.functions["{}namespace-uri"] = Functions.namespaceURI;
this.functions["{}name"] = Functions.name;
this.functions["{}string"] = Functions.string;
this.functions["{}concat"] = Functions.concat;
this.functions["{}starts-with"] = Functions.startsWith;
this.functions["{}contains"] = Functions.contains;
this.functions["{}substring-before"] = Functions.substringBefore;
this.functions["{}substring-after"] = Functions.substringAfter;
this.functions["{}substring"] = Functions.substring;
this.functions["{}string-length"] = Functions.stringLength;
this.functions["{}normalize-space"] = Functions.normalizeSpace;
this.functions["{}translate"] = Functions.translate;
this.functions["{}boolean"] = Functions.boolean_;
this.functions["{}not"] = Functions.not;
this.functions["{}true"] = Functions.true_;
this.functions["{}false"] = Functions.false_;
this.functions["{}lang"] = Functions.lang;
this.functions["{}number"] = Functions.number;
this.functions["{}sum"] = Functions.sum;
this.functions["{}floor"] = Functions.floor;
this.functions["{}ceiling"] = Functions.ceiling;
this.functions["{}round"] = Functions.round;
};

[링크 : https://github.com/goto100/xpath/blob/master/xpath.js]

'Programming > node.js' 카테고리의 다른 글

js nested function과 변수 scope  (0) 2019.09.15
node.js util.format / sprintf?  (0) 2019.09.10
node.js csv2json  (0) 2019.08.21
node.js regex  (0) 2019.08.12
node.js xpath 모듈  (0) 2019.08.08
Posted by 구차니

requires.txt 이런걸로 패키지 목록이 있으면 -r 옵션을 통해 손쉽게 설치할 수 있다.

pip install -r 파일명

[링크 : https://kwonnam.pe.kr/wiki/python/pip]

 

== 버전으로 특정 버전을 설치할 수 있다.

pip install module==1.10

[링크 : https://antilibrary.org/1122]

'Programming > python(파이썬)' 카테고리의 다른 글

python indent  (0) 2019.12.13
tensorflow, pytorch  (0) 2019.12.10
python expat parseFile()  (0) 2019.06.24
ubuntu에서 python으로 postgres 접속하기  (0) 2019.06.24
python pip 특정 버전 설치하기  (0) 2019.06.18
Posted by 구차니
Programming/xml2019. 9. 9. 19:19

항목이 몇개 있나 세어주는 함수

상위 경로가 중복으로 있을 경우 하위 항목을 세면

본인이 의도하지 않은 범위까지 세어버리니 주의가 필요하다

A - B

   - B

A - B

   - B

이런식으로 B를 세면 A가 두개이고 각각 B가 두개이니 2로 나올것 같지만 4개가 나온다.

count(/A[0]/B) 식으로 세어야 의도한 녀석의 갯수가 나온다.

 

[링크 : https://stackoverflow.com/questions/13799263/use-of-count-in-xpath-expressions?rq=1]

[링크 : https://examples.javacodegeeks.com/core-java/xml/xpath/xpath-count-example/]

'Programming > xml' 카테고리의 다른 글

xpath 복수개의 attribute 동시에 만족하는 항목 찾기  (0) 2019.09.14
xsd minOccurs, maxOccurs  (0) 2019.09.11
xpath xsi  (0) 2019.08.12
xpath concat  (0) 2019.08.08
xpath syntax - attribute 검색 및 특정값 얻기  (0) 2019.08.08
Posted by 구차니

내가 원하는건 아래의 예인데..

CROSS JOIN

 

I get: 
Col1 | Col2 | Col3 | Col4 | Col5  
--------------------------------- 
NULL | NULL | NULL |  2   |  0 
 7   |  3   |  4   | NULL | NULL 


I want to get 

Col1 | Col2 | Col3 | Col4 | Col5  
--------------------------------- 
  7  |  3   |   4  |  2   |  0

 

막상 쿼리를 보니 그냥 두개 합쳐서 골라서 빼내는 것 같네..

자동으로 null은 없애고 합치는건 없으려나?

SELECT B.Col1 
    ,B.col2 
    ,B.col3 
    ,A.col4 
    ,A.col5 
FROM ( 
    SELECT NULL AS Col1 
        ,NULL AS Col2 
        ,NULL AS Col3 
        ,2 AS Col4 
        ,0 AS Col5 
    ) A 
CROSS JOIN ( 
    SELECT 7 AS Col1 
        ,3 AS Col2 
        ,4 AS Col3 
        ,NULL AS Col4 
        ,NULL AS Col5 
    ) B

[링크 : https://stackoverflow.com/questions/36078353/sql-server-union-with-multiple-columns/36078940]

 

+

null을 없애고 합치는건 left join이 오히려 유용한건가?

[링크 : https://stackoverflow.com/questions/11461867/sql-cross-join-with-null-values]

'프로그램 사용 > postgreSQL' 카테고리의 다른 글

query tweak join vs large table  (0) 2019.09.17
postgresql csv import null as null  (0) 2019.09.11
sql 여러행을 하나로 합치기 concat  (0) 2019.09.08
값별 갯수 통계  (0) 2019.09.07
postgresql.conf 설정사항들  (0) 2019.09.06
Posted by 구차니

oracle에서는 WM_CONCAT

mysql에서는 GROUP_CONCAT

postgresql 에서는 ARRAY_TO_STRING(ARRAY_AGG(column_name),',')  으로 하면 된다고 한다.

 

[링크 : https://dmsrbdi123.tistory.com/11] postgresql

[링크 : https://gent.tistory.com/15] oracle

[링크 : https://extbrain.tistory.com/48] mysql

'프로그램 사용 > postgreSQL' 카테고리의 다른 글

postgresql csv import null as null  (0) 2019.09.11
cross join  (0) 2019.09.08
값별 갯수 통계  (0) 2019.09.07
postgresql.conf 설정사항들  (0) 2019.09.06
postgresql copy from csv , iso8859-1  (0) 2019.09.05
Posted by 구차니

distinct count만 생각했는데 group by를 써야하는 가였나..

 

위에는 distinct의 영향을 받아 order by column_name이 적용되고

아래는 order by가 적용되지 않는 순서로 나온다.(결과는 동일)

select distinct(column_name), count(*) from table group by(column_name)

select column_name, count(*) from table group by(column_name)

[링크 :https://stackoverflow.com/questions/7053902/sql-how-to-get-the-count-of-each-distinct-value-in-a-column]

'프로그램 사용 > postgreSQL' 카테고리의 다른 글

cross join  (0) 2019.09.08
sql 여러행을 하나로 합치기 concat  (0) 2019.09.08
postgresql.conf 설정사항들  (0) 2019.09.06
postgresql copy from csv , iso8859-1  (0) 2019.09.05
postgresql copy from csv, date null  (0) 2019.09.05
Posted by 구차니