Skip to content

Commit 3971c0d

Browse files
committed
Arreglos a la importación a mongo.
1 parent 374e7ec commit 3971c0d

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

addendum/mongo-utils/csv_to_mongo.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,6 @@ def to_date(d: str) -> datetime | None:
4444
func_to_cols: list[Callable[[str], str|int|float|datetime|None]] = \
4545
list(map(lambda c: to_date if 'date' in c.lower() else to_numeric, columns))
4646

47-
coll.insert_many(
48-
map(lambda row: {k: v for k in columns for v in [func(e) for (func,e) in zip(func_to_cols, row)]},
49-
reader))
47+
coll.insert_many([dict(zip(columns,
48+
[func(e) for (func,e) in zip(func_to_cols, row)]))
49+
for row in reader])

mongo/sesion3.ipynb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@
139139
},
140140
"outputs": [],
141141
"source": [
142-
"client = MongoClient(db_hostname, 27017)\n",
142+
"client: MongoClient = MongoClient(db_hostname, 27017, compressors='zstandard')\n",
143143
"client"
144144
]
145145
},
@@ -323,7 +323,7 @@
323323
"metadata": {},
324324
"outputs": [],
325325
"source": [
326-
"!wget -q https://raw.githubusercontent.com/dsevilla/bdge/24-25/addendum/mongo-utils/csv_to_mongo.py"
326+
"!wget -q https://raw.githubusercontent.com/dsevilla/bdge/25-26/addendum/mongo-utils/csv_to_mongo.py"
327327
]
328328
},
329329
{
@@ -1115,7 +1115,7 @@
11151115
"name": "python",
11161116
"nbconvert_exporter": "python",
11171117
"pygments_lexer": "ipython3",
1118-
"version": "3.12.8"
1118+
"version": "3.12.7"
11191119
}
11201120
},
11211121
"nbformat": 4,

0 commit comments

Comments
 (0)