kopia lustrzana https://github.com/simonw/datasette
				
				
				
			Fix for FTS virtual table counting error
							rodzic
							
								
									56623e48da
								
							
						
					
					
						commit
						012fc7c5cd
					
				|  | @ -929,9 +929,14 @@ class Datasette: | ||||||
|                     ] |                     ] | ||||||
|                     views = [v[0] for v in conn.execute('select name from sqlite_master where type = "view"')] |                     views = [v[0] for v in conn.execute('select name from sqlite_master where type = "view"')] | ||||||
|                     for table in table_names: |                     for table in table_names: | ||||||
|                         count = conn.execute( |                         try: | ||||||
|                             'select count(*) from {}'.format(escape_sqlite_table_name(table)) |                             count = conn.execute( | ||||||
|                         ).fetchone()[0] |                                 'select count(*) from {}'.format(escape_sqlite_table_name(table)) | ||||||
|  |                             ).fetchone()[0] | ||||||
|  |                         except sqlite3.OperationalError: | ||||||
|  |                             # This can happen when running against a FTS virtual tables | ||||||
|  |                             # e.g. "select count(*) from some_fts;" | ||||||
|  |                             count = 0 | ||||||
|                         label_column = None |                         label_column = None | ||||||
|                         # If table has two columns, one of which is ID, then label_column is the other one |                         # If table has two columns, one of which is ID, then label_column is the other one | ||||||
|                         column_names = [r[1] for r in conn.execute( |                         column_names = [r[1] for r in conn.execute( | ||||||
|  |  | ||||||
		Ładowanie…
	
		Reference in New Issue
	
	 Simon Willison
						Simon Willison