-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathbuild.sql
More file actions
27 lines (23 loc) · 710 Bytes
/
build.sql
File metadata and controls
27 lines (23 loc) · 710 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
INSTALL httpfs;
LOAD httpfs;
CREATE VIEW raw_mac AS
SELECT * FROM read_csv([
'http://standards-oui.ieee.org/oui/oui.csv',
'http://standards-oui.ieee.org/oui28/mam.csv',
'http://standards-oui.ieee.org/oui36/oui36.csv'
], header=True, columns={
'Registry': 'TEXT',
'Assignment': 'TEXT',
'Organization Name': 'TEXT',
'Organization Address': 'TEXT'
});
CREATE VIEW mac AS
SELECT
"Registry" AS registry,
"Assignment" AS assignment,
"Organization Name" AS org_name,
"Organization Address" AS org_address
FROM raw_mac
ORDER BY assignment, registry, org_name, org_address;
COPY mac TO 'mac.csv' (HEADER TRUE);
SELECT count(*) || ' records processed' AS status FROM mac;