This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
with tabela as ( | |
select format('%s.%s', quote_ident(nsp.nspname), quote_ident(t.tablename)) as tablename, c.oid | |
from pg_catalog.pg_tables t | |
inner join pg_catalog.pg_class c on c.relname = t.tablename | |
inner join pg_catalog.pg_namespace nsp on nsp.nspname = t.schemaname and nsp.oid = c.relnamespace | |
where t.tablename = :tablename and nsp.nspname = :schemaname | |
), cols_dif_resultado as ( | |
select | |
t.tablename, att.attname as col | |
from pg_catalog.pg_attribute att |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
with tabela as ( | |
select format('%s.%s', quote_ident(nsp.nspname), quote_ident(t.tablename)) as tablename, c.oid | |
from pg_catalog.pg_tables t | |
inner join pg_catalog.pg_class c on c.relname = t.tablename | |
inner join pg_catalog.pg_namespace nsp on nsp.nspname = t.schemaname and nsp.oid = c.relnamespace | |
where t.tablename = :tablename and nsp.nspname = :schemaname | |
), cases1 as ( | |
select | |
format('when i = %s and a.%s <> b.%s then ''%s''', row_number() over() - 1, quote_ident(att.attname), quote_ident(att.attname), quote_ident(att.attname)) as case1, | |
format('when i = %s and a.%s <> b.%s then a.%s::text', row_number() over() - 1, quote_ident(att.attname), quote_ident(att.attname), quote_ident(att.attname)) as case2, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- salva statistics de uso de tabelas | |
create temporary table "Abelardo Vieira Mota" as | |
select * from pg_catalog.pg_stat_user_tables; | |
-- SQL qualquer | |
-- verifica que mudanças houve | |
select | |
n.schemaname, n.relname, | |
t.seq_scan - n.seq_scan as seq_scan, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pandas as pd | |
from io import StringIO | |
s = """ | |
hora_ini,hora_fim | |
2018-07-01 00:01:00,2018-07-01 00:03:00 | |
2018-07-01 00:00:00,2018-07-01 00:04:00 | |
2018-07-01 00:00:00,2018-07-01 00:01:00 | |
2018-07-01 00:00:01,2018-07-01 00:01:00 | |
""" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
tempo = int(input('Diz a velocidade aí: ')) | |
espaco = int(input('Dis o espaço aí: ')) | |
velocidade = espaco / tempo | |
print('A velocidade é ', velocidade) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
s = """ | |
users artist gender plays age | |
0 a aesop rock m 72 28.0 | |
1 b air m 178 28.0 | |
2 c amon tobin m 106 28.0 | |
3 d animal collective m 203 28.0 | |
4 e annie m 75 28.0 | |
""" | |
import io |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
import xml.etree.ElementTree as ET | |
import pandas as pd | |
tree = ET.parse('../data/webnlg2017/challenge_data_train_dev/train/2triples/2triples_Airport_train_challenge.xml') | |
root = tree.getroot() | |
all_elem = list(root.iter('entry')) | |
# entries |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import re | |
import datetime | |
import codecs | |
c = re.compile('\d{1,4}-\d{1,2}-\d{1,2}') | |
with codecs.open('persondata_wkd_uris_pt.ttl', 'r', 'utf-8') as f_in, codecs.open('persondata_wkd_uris_pt.ttl.out', 'w', 'utf-8') as f_out: | |
for i, line in enumerate(f_in): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
s1.setInterrogative(YES_NO); | |
// Did the boys leave home? | |
s1.setInterrogative(WHERE, OBJECT); | |
// Where did the boys leave? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Phrase s1 = new SPhraseSpec(‘leave’); | |
s1.setTense(PAST); | |
s1.setObject(new NPPhraseSpec(‘the’, ‘house’)); | |
Phrase s2 = new StringPhraseSpec(‘the boys’); | |
s1.setSubject(s2); |