{ "cells": [ { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [], "source": [ "import os\n", "work_directory = r\"D:\\Project_Multimedika\\Projek_2\\fullstack_summarizer_and_bot_development\\backend\"\n", "os.chdir(work_directory)" ] }, { "cell_type": "code", "execution_count": 3, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "2024-10-02 10:13:26,616 DEBUG sqlalchemy.pool.impl.QueuePool Created new connection <_mysql.connection open to 'mysql-1034fd4a-hamzahibnuarman-ad3d.e.aivencloud.com' at 0000014BA7A87210>\n", "2024-10-02 10:13:26,782 INFO sqlalchemy.engine.Engine SELECT DATABASE()\n", "2024-10-02 10:13:26,782 INFO sqlalchemy.engine.Engine [raw sql] ()\n", "2024-10-02 10:13:26,960 INFO sqlalchemy.engine.Engine SELECT @@sql_mode\n", "2024-10-02 10:13:26,974 INFO sqlalchemy.engine.Engine [raw sql] ()\n", "2024-10-02 10:13:27,059 INFO sqlalchemy.engine.Engine SELECT @@lower_case_table_names\n", "2024-10-02 10:13:27,060 INFO sqlalchemy.engine.Engine [raw sql] ()\n", "2024-10-02 10:13:27,235 DEBUG sqlalchemy.pool.impl.QueuePool Connection <_mysql.connection open to 'mysql-1034fd4a-hamzahibnuarman-ad3d.e.aivencloud.com' at 0000014BA7A87210> checked out from pool\n", "Connection successful!\n", "2024-10-02 10:13:27,235 DEBUG sqlalchemy.pool.impl.QueuePool Connection <_mysql.connection open to 'mysql-1034fd4a-hamzahibnuarman-ad3d.e.aivencloud.com' at 0000014BA7A87210> being returned to pool\n", "2024-10-02 10:13:27,238 DEBUG sqlalchemy.pool.impl.QueuePool Connection <_mysql.connection open to 'mysql-1034fd4a-hamzahibnuarman-ad3d.e.aivencloud.com' at 0000014BA7A87210> rollback-on-return\n" ] } ], "source": [ "from sqlalchemy import create_engine\n", "\n", "SQLALCHEMY_DATABASE_URL = (\n", " \"mysql://avnadmin:AVNS_St9zLKGWwfGKvC2yMCz@mysql-1034fd4a-hamzahibnuarman-ad3d.e.aivencloud.com:10707/summarizer\"\n", ")\n", "engine = create_engine(\n", " SQLALCHEMY_DATABASE_URL,\n", " echo=True,\n", " echo_pool=\"debug\",\n", " connect_args={\n", " \"ssl\": {\n", " 'sslmode': \"REQUIRED\",\n", " \"ca\": \"ca.pem\", # Update this path to your CA certificate\n", " # Other SSL options can be added here\n", " }\n", " }\n", ")\n", "\n", "# Test connection\n", "try:\n", " with engine.connect() as connection:\n", " print(\"Connection successful!\")\n", "except Exception as e:\n", " print(\"Error connecting to the database:\", str(e))" ] } ], "metadata": { "kernelspec": { "display_name": "fullstack", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.11.9" } }, "nbformat": 4, "nbformat_minor": 2 }