Skip to content

Commit 3afd90b

Browse files
committed
isolate debugging
1 parent 22ba83b commit 3afd90b

File tree

1 file changed

+27
-11
lines changed

1 file changed

+27
-11
lines changed

alloydb/notebooks/embeddings_batch_processing.ipynb

Lines changed: 27 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -577,6 +577,32 @@
577577
"await pool.dispose()"
578578
]
579579
},
580+
{
581+
"cell_type": "code",
582+
"execution_count": null,
583+
"metadata": {},
584+
"outputs": [],
585+
"source": [
586+
"# DEBUG(glasnt): try an early select statement\n",
587+
"import logging\n",
588+
"\n",
589+
"logger = logging.getLogger(\"glasnt_debug\")\n",
590+
"cols_to_embed = [\"analysis\", \"overview\"]\n",
591+
"pool = await init_connection_pool(connector, database_name, pool_size=10)\n",
592+
"logger.info(f\"Checking initial data source...\")\n",
593+
"\n",
594+
"# Check table schema\n",
595+
"with pool.connect() as db_conn:\n",
596+
" result = db_conn.execute(sqlalchemy.text(\"\"\"\n",
597+
" select table_name, column_name, data_type, character_maximum_length, column_default, is_nullable\n",
598+
" from INFORMATION_SCHEMA.COLUMNS where table_name = '{table_name}' order by column_name;\"\"\")).fetchall()\n",
599+
" db_conn.commit()\n",
600+
"\n",
601+
" for row in result:\n",
602+
" logger.info(row)\n",
603+
"logger.info(\"Done.\")\n"
604+
]
605+
},
580606
{
581607
"cell_type": "markdown",
582608
"metadata": {
@@ -666,17 +692,7 @@
666692
" async for row in await conn.stream(text(sql)):\n",
667693
" logger.debug(f\"yielded row: {row._mapping['id']}\")\n",
668694
" # Yield the row as a dictionary (RowMapping)\n",
669-
" yield row._mapping\n",
670-
"\n",
671-
"# DEBUG(glasnt): try an early select statement\n",
672-
"\n",
673-
"logger = logging.getLogger(\"glasnt_debug\")\n",
674-
"cols_to_embed = [\"analysis\", \"overview\"]\n",
675-
"pool = await init_connection_pool(connector, database_name, pool_size=10)\n",
676-
"logger.info(f\"Checking initial data source...\")\n",
677-
"source_data = get_source_data(pool, cols_to_embed)\n",
678-
"logger.info(source_data)\n",
679-
"\n"
695+
" yield row._mapping"
680696
]
681697
},
682698
{

0 commit comments

Comments
 (0)