Skip to content

Commit 1ad304d

Browse files
authored
Remove pandavro import and remove numpy 2 dep (#1765)
1 parent 3f2c478 commit 1ad304d

File tree

5 files changed

+145
-104
lines changed

5 files changed

+145
-104
lines changed

python-package/basedosdados/upload/datatypes.py

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,16 @@
77
import pandas as pd
88
from google.cloud import bigquery
99

10-
try:
11-
import pandavro
12-
13-
_avro_dependencies = True
14-
except ImportError:
15-
_avro_dependencies = False
16-
1710
from basedosdados.exceptions import BaseDosDadosMissingDependencyException
1811

12+
_avro_dependencies = False
13+
# try:
14+
# import pandavro
15+
#
16+
# _avro_dependencies = True
17+
# except ImportError:
18+
# _avro_dependencies = False
19+
1920

2021
class Datatype:
2122
"""
@@ -59,19 +60,18 @@ def header(self, data_sample_path, csv_delimiter: str = ","):
5960
return next(csv_reader)
6061

6162
if self.source_format == "avro":
63+
# TODO: Restore support for avro format
64+
# See https://github.com/ynqa/pandavro/issues/56 and https://github.com/basedosdados/sdk/issues/1728
6265
if not _avro_dependencies:
63-
raise BaseDosDadosMissingDependencyException(
64-
"Optional dependencies for handling AVRO files are not installed. "
65-
'Please install basedosdados with the "avro" extra, such as:'
66-
"\n\npip install basedosdados[avro]"
67-
)
68-
dataframe = pandavro.read_avro(str(data_sample_path))
69-
return list(dataframe.columns.values)
66+
msg = "Handling avro file is currently not supported due to a limitation. See https://github.com/ynqa/pandavro/issues/56"
67+
raise BaseDosDadosMissingDependencyException(msg)
68+
# dataframe = pandavro.read_avro(str(data_sample_path))
69+
# return list(dataframe.columns.values)
7070
if self.source_format == "parquet":
7171
dataframe = pd.read_parquet(str(data_sample_path))
7272
return list(dataframe.columns.values)
7373
raise NotImplementedError(
74-
"Base dos Dados just supports comma separated csv, avro and parquet files"
74+
"Base dos Dados just supports comma separated csv and parquet files"
7575
)
7676

7777
def partition(self):
@@ -108,7 +108,7 @@ def external_config(self):
108108
_external_config = bigquery.ExternalConfig("PARQUET")
109109
else:
110110
raise NotImplementedError(
111-
"Base dos Dados just supports csv, avro and parquet files"
111+
"Base dos Dados just supports csv and parquet files"
112112
)
113113
_external_config.source_uris = self.uri
114114
if self.partitioned:

0 commit comments

Comments
 (0)