18 lines
		
	
	
		
			673 B
		
	
	
	
		
			Python
		
	
	
	
			
		
		
	
	
			18 lines
		
	
	
		
			673 B
		
	
	
	
		
			Python
		
	
	
	
| from sqlalchemy import create_engine, inspect
 | |
| 
 | |
| # Подключаемся к БД
 | |
| engine = create_engine("sqlite:///./glass_cutting.db")
 | |
| inspector = inspect(engine)
 | |
| 
 | |
| # Получаем список таблиц
 | |
| print("Таблицы в БД:", inspector.get_table_names())
 | |
| 
 | |
| # Получаем информацию по конкретной таблице
 | |
| if "calculations" in inspector.get_table_names():
 | |
|     columns = inspector.get_columns("calculations")
 | |
|     print("\nСтруктура таблицы 'calculations':")
 | |
|     for column in columns:
 | |
|         print(f"{column['name']} ({column['type']})")
 | |
| else:
 | |
|     print("Таблица 'calculations' не найдена.")
 |