|
128 | 128 | "metadata": {}, |
129 | 129 | "outputs": [ |
130 | 130 | { |
131 | | - "data": { |
132 | | - "text/html": [ |
133 | | - "Query job 6d85c081-49c7-408a-ab96-e0e9e5102419 is DONE. 171.4 MB processed. <a target=\"_blank\" href=\"https://console.cloud.google.com/bigquery?project=bigframes-dev&j=bq:US:6d85c081-49c7-408a-ab96-e0e9e5102419&page=queryresults\">Open Job</a>" |
134 | | - ], |
135 | | - "text/plain": [ |
136 | | - "<IPython.core.display.HTML object>" |
137 | | - ] |
138 | | - }, |
139 | | - "metadata": {}, |
140 | | - "output_type": "display_data" |
141 | | - }, |
142 | | - { |
143 | | - "data": { |
144 | | - "application/vnd.jupyter.widget-view+json": { |
145 | | - "model_id": "31ba8e41e4ca4579b85409237cb7a566", |
146 | | - "version_major": 2, |
147 | | - "version_minor": 0 |
148 | | - }, |
149 | | - "text/plain": [ |
150 | | - "TableWidget(page_size=10, row_count=5552452, table_html='<table border=\"1\" class=\"dataframe table table-stripe…" |
151 | | - ] |
152 | | - }, |
153 | | - "metadata": {}, |
154 | | - "output_type": "display_data" |
| 131 | + "name": "stderr", |
| 132 | + "output_type": "stream", |
| 133 | + "text": [ |
| 134 | + "/usr/local/google/home/shuowei/src/github.com/googleapis/python-bigquery-dataframes/bigframes/dataframe.py:868: UserWarning: Anywidget mode is not available. Please `pip install anywidget traitlets` or `pip install 'bigframes[anywidget]'` to use interactive tables. Falling back to deferred mode. Error: Traceback (most recent call last):\n", |
| 135 | + " File \"/usr/local/google/home/shuowei/src/github.com/googleapis/python-bigquery-dataframes/bigframes/dataframe.py\", line 861, in _repr_html_\n", |
| 136 | + " widget = display.TableWidget(df.copy())\n", |
| 137 | + " File \"/usr/local/google/home/shuowei/src/github.com/googleapis/python-bigquery-dataframes/bigframes/display/anywidget.py\", line 100, in __init__\n", |
| 138 | + " self.row_count = self._batches.total_rows or 0\n", |
| 139 | + "AttributeError: 'TableWidget' object has no attribute '_batches'\n", |
| 140 | + "\n", |
| 141 | + " warnings.warn(\n" |
| 142 | + ] |
155 | 143 | }, |
156 | 144 | { |
157 | 145 | "data": { |
158 | | - "text/html": [], |
| 146 | + "text/html": [ |
| 147 | + "Computation deferred. Computation will process 171.4 MB" |
| 148 | + ], |
159 | 149 | "text/plain": [ |
160 | 150 | "Computation deferred. Computation will process 171.4 MB" |
161 | 151 | ] |
|
184 | 174 | "metadata": {}, |
185 | 175 | "outputs": [ |
186 | 176 | { |
187 | | - "data": { |
188 | | - "text/html": [ |
189 | | - "Query job 48cb4908-a59a-420f-8fcb-200d0d9187ef is DONE. 171.4 MB processed. <a target=\"_blank\" href=\"https://console.cloud.google.com/bigquery?project=bigframes-dev&j=bq:US:48cb4908-a59a-420f-8fcb-200d0d9187ef&page=queryresults\">Open Job</a>" |
190 | | - ], |
191 | | - "text/plain": [ |
192 | | - "<IPython.core.display.HTML object>" |
193 | | - ] |
194 | | - }, |
195 | | - "metadata": {}, |
196 | | - "output_type": "display_data" |
197 | | - }, |
198 | | - { |
199 | | - "name": "stdout", |
200 | | - "output_type": "stream", |
201 | | - "text": [ |
202 | | - "Total pages: 555246\n" |
| 177 | + "ename": "AttributeError", |
| 178 | + "evalue": "'TableWidget' object has no attribute '_batches'", |
| 179 | + "output_type": "error", |
| 180 | + "traceback": [ |
| 181 | + "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", |
| 182 | + "\u001b[0;31mAttributeError\u001b[0m Traceback (most recent call last)", |
| 183 | + "\u001b[0;32m<ipython-input-7-49e9807f0359>\u001b[0m in \u001b[0;36m<cell line: 5>\u001b[0;34m()\u001b[0m\n\u001b[1;32m 3\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 4\u001b[0m \u001b[0;31m# Create widget programmatically\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m----> 5\u001b[0;31m \u001b[0mwidget\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mTableWidget\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mdf\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 6\u001b[0m \u001b[0mprint\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34mf\"Total pages: {math.ceil(widget.row_count / widget.page_size)}\"\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 7\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n", |
| 184 | + "\u001b[0;32m~/src/github.com/googleapis/python-bigquery-dataframes/bigframes/display/anywidget.py\u001b[0m in \u001b[0;36m__init__\u001b[0;34m(self, dataframe)\u001b[0m\n\u001b[1;32m 98\u001b[0m \u001b[0;31m# TODO(b/452747934): Allow row_count to be None and check to see if\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 99\u001b[0m \u001b[0;31m# there are multiple pages and show \"page 1 of many\" in this case\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 100\u001b[0;31m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mrow_count\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_batches\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mtotal_rows\u001b[0m \u001b[0;32mor\u001b[0m \u001b[0;36m0\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 101\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 102\u001b[0m \u001b[0;31m# get the initial page\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", |
| 185 | + "\u001b[0;31mAttributeError\u001b[0m: 'TableWidget' object has no attribute '_batches'" |
203 | 186 | ] |
204 | | - }, |
205 | | - { |
206 | | - "data": { |
207 | | - "application/vnd.jupyter.widget-view+json": { |
208 | | - "model_id": "5d22f3f19e4140b0ba51869e97c3f690", |
209 | | - "version_major": 2, |
210 | | - "version_minor": 0 |
211 | | - }, |
212 | | - "text/plain": [ |
213 | | - "TableWidget(page_size=10, row_count=5552452, table_html='<table border=\"1\" class=\"dataframe table table-stripe…" |
214 | | - ] |
215 | | - }, |
216 | | - "metadata": {}, |
217 | | - "output_type": "display_data" |
218 | 187 | } |
219 | 188 | ], |
220 | 189 | "source": [ |
|
239 | 208 | }, |
240 | 209 | { |
241 | 210 | "cell_type": "code", |
242 | | - "execution_count": 8, |
| 211 | + "execution_count": null, |
243 | 212 | "id": "12b68f15", |
244 | 213 | "metadata": {}, |
245 | | - "outputs": [ |
246 | | - { |
247 | | - "name": "stdout", |
248 | | - "output_type": "stream", |
249 | | - "text": [ |
250 | | - "Current page: 0\n", |
251 | | - "After next: 1\n", |
252 | | - "After prev: 0\n" |
253 | | - ] |
254 | | - } |
255 | | - ], |
| 214 | + "outputs": [], |
256 | 215 | "source": [ |
257 | 216 | "# Simulate button clicks programmatically\n", |
258 | 217 | "print(\"Current page:\", widget.page)\n", |
|
0 commit comments