cesar_garcia_saez
06/17/2022, 2:15 PMcesar_garcia_saez
06/17/2022, 2:15 PMversion: 1
default_environment: dev
send_anonymous_usage_stats: false
plugins:
extractors:
- name: tap-spreadsheets-anywhere
variant: ets
pip_url: git+<https://github.com/ets/tap-spreadsheets-anywhere.git>
loaders:
- name: target-csv
variant: hotgluexyz
pip_url: git+<https://github.com/hotgluexyz/target-csv.git@0.3.3>
environments:
- name: dev
config:
plugins:
extractors:
- name: tap-spreadsheets-anywhere
config:
tables:
- path: <https://datos.madrid.es/egob/catalogo>
pattern: 300193-7-licencias-urbanisticas.xlsx
name: obras_2022
format: excel
key_properties: []
worksheet_name: Listado de Licencias concedidas
start_date: '2017-05-01T00:00:00Z'
loaders:
- name: target-csv
config:
delimiter: ;
- name: staging
- name: prod
Edit: Removed an extra slash at the end of `path`URLcesar_garcia_saez
06/17/2022, 2:16 PMmeltano-obras-local % meltano invoke tap-spreadsheets-anywhere --discover
2022-06-17T14:15:30.498375Z [info ] Environment 'dev' is active
INFO Assembled <https://datos.madrid.es/egob/catalogo//300193-7-licencias-urbanisticas.xlsx> as the URL to a source file.
INFO Checking 1 resolved objects for any that match regular expression "300193-7-licencias-urbanisticas.xlsx" and were modified since 2017-05-01 00:00:00+00:00
INFO Processing 1 resolved objects that met our criteria. Enable debug verbosity logging for more details.
INFO Sampling 300193-7-licencias-urbanisticas.xlsx (1000 records, every 5th record).
ERROR Unable to write Catalog entry for 'obras_2022' - it will be skipped due to error Bad magic number for central directory
{
"streams": []
}%cesar_garcia_saez
06/20/2022, 8:41 PMcurl -s -o /dev/stdout --dump-header /dev/stderr <https://datos.madrid.es/egob/catalogo/300193-7-licencias-urbanisticas.xlsx> | file -
HTTP/2 302
x-frame-options: SAMEORIGIN
x-xss-protection: 1; mode=block
x-content-type-options: nosniff
location: <https://datos.madrid.es:443/datosabiertos/URBANISMO/INFORMACION_URBANISTICA/LICENCIAS/2022/05/I150_202205.xlsx>
content-encoding: gzip
x-ua-compatible: IE=8
content-length: 20
content-type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet
date: Mon, 20 Jun 2022 14:31:37 GMT
set-cookie: ROUTEID=.app01; path=/
strict-transport-security: max-age=15768000cesar_garcia_saez
06/20/2022, 9:12 PMI150_20205.xlsx to obras.gzip and tried to decompress the file using Python. This is the script I used:
#!/usr/bin/python3
from zipfile import ZipFile
zf = ZipFile("./obras.gzip")
zf.extractall(path = './input/')
zf.close()cesar_garcia_saez
06/20/2022, 9:13 PMcesar_garcia_saez
06/20/2022, 9:18 PMcesar_garcia_saez
06/20/2022, 10:02 PMmeltano elt is the only way to get the logger messages from the taps being used.. If you want to get the message from the singer taps this is the only option.
• meltano run is the recommended option to run cross-plugin workflows, but you can’t get the output of the taps using this option.
• meltano invoke tap-xxx --discover enables you to build the catalog. But if catalog creation fails, you can’t get the tap log info in the output.
In my particular case, my catalog is not created plus the tap debug info doesn’t appear on the output (as in the example shown in the docs)cesar_garcia_saez
06/20/2022, 10:08 PM<plugin name> (out) prefixes:
This is the sample output from the docs (note the column on the left, specifying the plugin source)
tap-gitlab | INFO Starting sync
tap-gitlab (out) | {"type": "SCHEMA", "stream": "projects", "schema": {"type": "object", "properties": {...}}, "key_properties": ["id"]}
tap-gitlab (out) | {"type": "RECORD", "stream": "projects", "record": {"id": 7603319, "name": "Meltano", ...}, "time_extracted": "2020-08-05T21:30:22.988250Z"}
tap-gitlab (out) | {"type": "STATE", "value": {"project_7603319": "2020-08-05T21:04:59.158000Z"}}
tap-gitlab | INFO Sync complete
target-jsonl (out) | {"project_7603319": "2020-08-05T21:04:59.158000Z"}
meltano | INFO Incremental state has been updated at 2020-08-05 21:30:26.669170.
meltano | DEBUG Incremental state: {'project_7603319': '2020-08-05T21:04:59.158000Z'}
meltano | INFO Extract & load complete!cesar_garcia_saez
06/20/2022, 10:10 PM022-06-20T21:49:20.868063Z [info ] INFO Sampling 300193-7-licencias-urbanisticas.xlsx (1000 records, every 5th record). name=tap-spreadsheets-anywhere stdio=stderr type=discovery
2022-06-20T21:49:21.963271Z [info ] ERROR Error trying to access '[{'key': '300193-7-licencias-urbanisticas.xlsx', 'last_modified': datetime.datetime(2022, 6, 5, 22, 32, 23, tzinfo=<UTC>)}]' name=tap-spreadsheets-anywhere stdio=stderr type=discovery
2022-06-20T21:49:21.963911Z [info ] ERROR Unable to write Catalog entry for 'obras2022' - it will be skipped due to error Bad magic number for central directory name=tap-spreadsheets-anywhere stdio=stderr type=discoverycesar_garcia_saez
06/20/2022, 10:19 PMcesar_garcia_saez
06/21/2022, 7:53 AMmeltano --log-level=debug elt tap-xx target-xx outputs the Singer messages to the output, along with meltano messages? I can’t get the sample out provided in the docsedgar_ramirez_mondragon
06/21/2022, 3:08 PMdebug logging should display every single singer message emitted by the tapcesar_garcia_saez
06/21/2022, 3:59 PMLOGGER.debug('This message should appear on the console')
I will try to devote more efforts to this issue next week, to see if I can get reproduce the error with local file, etc. I have been able to decompress the file with Python gzip library, but not with ZipFile (that has more methods to verify and check zip files)cesar_garcia_saez
06/21/2022, 4:08 PMmeltano invoke tap-spreadsheets-anywhere --discover
2022-06-21T16:02:44.466512Z [info ] Environment 'dev' is active
INFO Assembled <https://datos.madrid.es:443/datosabiertos/URBANISMO/INFORMACION_URBANISTICA/LICENCIAS/2021/12/I150_202112.xlsx> as the URL to a source file.
INFO Checking 1 resolved objects for any that match regular expression "I150_202112.xlsx" and were modified since 2017-05-01 00:00:00+00:00
INFO Processing 1 resolved objects that met our criteria. Enable debug verbosity logging for more details.
INFO Sampling I150_202112.xlsx (1000 records, every 5th record).
ERROR Unable to write Catalog entry for 'obras2022' - it will be skipped due to error Bad magic number for central directory
{
"streams": []
}%cesar_garcia_saez
06/21/2022, 4:09 PMmeltano invoke tap-spreadsheets-anywhere --discover
2022-06-21T16:03:09.938206Z [info ] Environment 'dev' is active
INFO Assembled <https://datos.madrid.es:443/datosabiertos/URBANISMO/INFORMACION_URBANISTICA/LICENCIAS/2021/11/I150_202112.xlsx> as the URL to a source file.
ERROR Unable to write Catalog entry for 'obras2022' - it will be skipped due to error Configured URL <https://datos.madrid.es:443/datosabiertos/URBANISMO/INFORMACION_URBANISTICA/LICENCIAS/2021/11/I150_202112.xlsx> could not be read.
{
"streams": []
}%cesar_garcia_saez
06/21/2022, 4:10 PMcesar_garcia_saez
06/21/2022, 5:44 PMcesar_garcia_saez
06/21/2022, 5:45 PM{
"version": "0.2.0",
"configurations": [
{
"name": "Python: archivo actual",
"type": "python",
"request": "launch",
"program": "${workspaceRoot}/__init__.py",
"console": "integratedTerminal",
"args": [
"--config",
"${workspaceRoot}/config.json"
],
"justMyCode": true
}
]
}cesar_garcia_saez
06/21/2022, 5:51 PM{
"tables": [
{
"path": "<https://opendata-ajuntament.barcelona.cat/data/dataset/368c71a0-55ef-4760-b388-93c75d3de458/resource/9fbc550b-c928-4f25-871f-684b6e5d218d/download>",
"name": "dades2020",
"format": "excel",
"key_properties": [],
"worksheet_name": "resum 2020",
"start_date": "2017-05-01T00:00:00Z",
"pattern": "2020_dades_sindicals.xlsx"
}
]
}
From National Institute of Statistics (same error about Magic number):
{
"tables": [
{
"path": "<https://www.ine.es/jaxi/files/_px/xlsx/t20/e244/avance/p02>",
"name": "dades2020",
"format": "excel",
"key_properties": [],
"start_date": "2017-05-01T00:00:00Z",
"pattern": "5mun16.xlsx"
}
]
}
From tap-spreadsheets-anywhere tests folder (Works!):
{
"tables": [
{
"path": "<https://github.com/ets/tap-spreadsheets-anywhere/raw/master/tap_spreadsheets_anywhere/test>",
"name": "testnoerrors",
"format": "excel",
"key_properties": [],
"worksheet_name": "sample_with_bad_newlines",
"start_date": "2017-05-01T00:00:00Z",
"pattern": "excel_with_no_errors.xlsx"
}
]
}edgar_ramirez_mondragon
06/21/2022, 5:57 PMcesar_garcia_saez
06/21/2022, 7:17 PMcurl -s -o /dev/stdout --dump-header /dev/stderr <https://www.ine.es/jaxi/files/_px/xlsx/t20/e244/avance/p02/5mun16.xlsx> | file -
HTTP/1.1 200 OK
Date: Tue, 21 Jun 2022 19:07:33 GMT
Access-Control-Allow-Origin: *
X-UA-Compatible: IE=edge
Cache-Control: no-cache
Expires: Thu, 01 Jan 1970 00:00:00 GMT
Content-Disposition: attachment;filename=5mun16.xlsx
Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=ISO-8859-15
Content-Language: es-ES
Set-Cookie: INE_WEB_COOKIE=es_ES; Max-Age=31536000; Expires=Wed, 21-Jun-2023 19:07:32 GMT; Path=/; HttpOnly
Set-Cookie: JSESSIONID=81BE95B168B67273279D782B7C6CA12A.jaxiPx01; Path=/jaxiPx; HttpOnly
Set-Cookie: TS01c34874=018b1b3cc2914695c127aa626aeed7d6dad22dbd64c30086d5f0e688fa841999b9541351e3fcf3d204240056117ba96ffd9f96337f; Path=/; Domain=.<http://www.ine.es|www.ine.es>
Set-Cookie: TS01ce9c24=018b1b3cc2914695c127aa626aeed7d6dad22dbd64c30086d5f0e688fa841999b9541351e3fcf3d204240056117ba96ffd9f96337f; path=/jaxiPx
Transfer-Encoding: chunked
/dev/stdin: Microsoft OOXML
Example 2:
curl -s -o /dev/stdout --dump-header /dev/stderr <https://opendata-ajuntament.barcelona.cat/data/dataset/368c71a0-55ef-4760-b388-93c75d3de458/resource/9fbc550b-c928-4f25-871f-684b6e5d218d/download/2020_dades_sindicals.xlsx> | file -
HTTP/1.1 200 OK
Server: nginx
Date: Tue, 21 Jun 2022 19:08:51 GMT
Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet
Content-Length: 26428
Connection: keep-alive
Pragma: no-cache
Cache-Control: no-cache
Accept-Ranges: bytes
ETag: "1606402854.31-26428"
Last-Modified: Thu, 26 Nov 2020 15:00:54 GMT
Content-Range: bytes 0-26427/26428
Example 3:
curl -s -o /dev/stdout --dump-header /dev/stderr <https://datos.madrid.es/egob/catalogo/300193-7-licencias-urbanisticas.xlsx> | file -
HTTP/2 302
x-frame-options: SAMEORIGIN
x-xss-protection: 1; mode=block
x-content-type-options: nosniff
location: <https://datos.madrid.es:443/datosabiertos/URBANISMO/INFORMACION_URBANISTICA/LICENCIAS/2022/05/I150_202205.xlsx>
content-encoding: gzip
x-ua-compatible: IE=8
content-length: 20
content-type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet
date: Tue, 21 Jun 2022 19:09:42 GMT
set-cookie: ROUTEID=.app01; path=/
strict-transport-security: max-age=15768000
/dev/stdin: gzip compressed data, from Unix
Example 1 appears as Microsoft OOXML, Example 2 as Microsoft Excel 2007+ and last one gzip compressed data, from Unix.cesar_garcia_saez
06/21/2022, 7:20 PM