|
12 | 12 | }, |
13 | 13 | { |
14 | 14 | "cell_type": "code", |
15 | | - "execution_count": null, |
| 15 | + "execution_count": 1, |
16 | 16 | "id": "bdd3e404", |
17 | 17 | "metadata": {}, |
18 | 18 | "outputs": [], |
|
33 | 33 | }, |
34 | 34 | { |
35 | 35 | "cell_type": "code", |
36 | | - "execution_count": null, |
| 36 | + "execution_count": 2, |
37 | 37 | "id": "0ce8b2d3", |
38 | 38 | "metadata": {}, |
39 | 39 | "outputs": [], |
40 | 40 | "source": [ |
41 | | - "client_id = \"\"\n", |
42 | | - "client_secret = \"\"\n", |
43 | | - "account_name = \"\"\n", |
44 | | - "engine_name = \"\" # Optional\n", |
45 | | - "database_name = \"\" # Optional\n", |
46 | | - "api_endpoint = DEFAULT_API_URL # Optional" |
| 41 | + "client_id = \"fN7Gr5c6lTWrzDol6RwyDOlDQVZFuoUd\"\n", |
| 42 | + "client_secret = \"Lh2fznC_iiiV4CEYcOedCAc4Q1FxqwyaXbj5s0MiUoQhVNapvylLuRMvuEnKkySu\"\n", |
| 43 | + "account_name = \"developer\"\n", |
| 44 | + "engine_name = \"petro_test\" # Optional\n", |
| 45 | + "database_name = \"petro_test\" # Optional\n", |
| 46 | + "api_endpoint = \"api.staging.firebolt.io\" # Optional" |
| 47 | + ] |
| 48 | + }, |
| 49 | + { |
| 50 | + "cell_type": "code", |
| 51 | + "execution_count": 3, |
| 52 | + "id": "60eec74a", |
| 53 | + "metadata": {}, |
| 54 | + "outputs": [], |
| 55 | + "source": [ |
| 56 | + "import logging\n", |
| 57 | + "\n", |
| 58 | + "# Configure logging to display messages in the notebook\n", |
| 59 | + "logging.basicConfig(level=logging.WARNING) # Set global level to WARNING to avoid noise\n", |
| 60 | + "\n", |
| 61 | + "# Set up cache-specific logger with DEBUG level\n", |
| 62 | + "cache_logger = logging.getLogger(\"firebolt.utils.cache\")\n", |
| 63 | + "cache_logger.setLevel(logging.DEBUG)\n", |
| 64 | + "\n", |
| 65 | + "# Create a console handler for the cache logger if it doesn't have one\n", |
| 66 | + "if not cache_logger.handlers:\n", |
| 67 | + " console_handler = logging.StreamHandler()\n", |
| 68 | + " console_handler.setLevel(logging.DEBUG)\n", |
| 69 | + " formatter = logging.Formatter(\"%(name)s - %(levelname)s - %(message)s\")\n", |
| 70 | + " console_handler.setFormatter(formatter)\n", |
| 71 | + " cache_logger.addHandler(console_handler)\n", |
| 72 | + " # Prevent messages from propagating to the root logger to avoid duplication\n", |
| 73 | + " cache_logger.propagate = False" |
47 | 74 | ] |
48 | 75 | }, |
49 | 76 | { |
|
56 | 83 | }, |
57 | 84 | { |
58 | 85 | "cell_type": "code", |
59 | | - "execution_count": null, |
| 86 | + "execution_count": 4, |
| 87 | + "id": "176bb75d", |
| 88 | + "metadata": {}, |
| 89 | + "outputs": [ |
| 90 | + { |
| 91 | + "name": "stderr", |
| 92 | + "output_type": "stream", |
| 93 | + "text": [ |
| 94 | + "firebolt.utils.cache - DEBUG - Clearing memory cache\n" |
| 95 | + ] |
| 96 | + } |
| 97 | + ], |
| 98 | + "source": [ |
| 99 | + "from firebolt.utils.cache import _firebolt_cache\n", |
| 100 | + "\n", |
| 101 | + "_firebolt_cache.clear()" |
| 102 | + ] |
| 103 | + }, |
| 104 | + { |
| 105 | + "cell_type": "code", |
| 106 | + "execution_count": 5, |
60 | 107 | "id": "646869f7", |
61 | 108 | "metadata": {}, |
62 | | - "outputs": [], |
| 109 | + "outputs": [ |
| 110 | + { |
| 111 | + "name": "stderr", |
| 112 | + "output_type": "stream", |
| 113 | + "text": [ |
| 114 | + "firebolt.utils.cache - DEBUG - Decryption failed for /Users/petrotiurin/Library/Application Support/firebolt/JG__FqhfFJ-fIbZg_O1xcDiwRJ-Vk1jPnGpPpMMKy8h0jnS179yIl6vfG1hIM8dSkOs8ZiZy6VSjcrD62gWt-imOzPAvxmhSMOFbrSquG5iGCms6SXjQ0UPlUpa4zI0qgf6ncH0Y76TfY7mipq81PZGK69GGfcOFYenkBsoyPgM.txt\n", |
| 115 | + "firebolt.utils.cache - DEBUG - Setting value in cache\n", |
| 116 | + "firebolt.utils.cache - DEBUG - Writing data to /Users/petrotiurin/Library/Application Support/firebolt/JG__FqhfFJ-fIbZg_O1xcDiwRJ-Vk1jPnGpPpMMKy8h0jnS179yIl6vfG1hIM8dSkOs8ZiZy6VSjcrD62gWt-imOzPAvxmhSMOFbrSquG5iGCms6SXjQ0UPlUpa4zI0qgf6ncH0Y76TfY7mipq81PZGK69GGfcOFYenkBsoyPgM.txt\n", |
| 117 | + "firebolt.utils.cache - DEBUG - Cache hit in memory\n", |
| 118 | + "firebolt.utils.cache - DEBUG - Cache hit in memory\n", |
| 119 | + "firebolt.utils.cache - DEBUG - Setting value in cache\n", |
| 120 | + "firebolt.utils.cache - DEBUG - Writing data to /Users/petrotiurin/Library/Application Support/firebolt/JG__FqhfFJ-fIbZg_O1xcDiwRJ-Vk1jPnGpPpMMKy8h0jnS179yIl6vfG1hIM8dSkOs8ZiZy6VSjcrD62gWt-imOzPAvxmhSMOFbrSquG5iGCms6SXjQ0UPlUpa4zI0qgf6ncH0Y76TfY7mipq81PZGK69GGfcOFYenkBsoyPgM.txt\n", |
| 121 | + "firebolt.utils.cache - DEBUG - Cache hit in memory\n", |
| 122 | + "firebolt.utils.cache - DEBUG - Setting value in cache\n", |
| 123 | + "firebolt.utils.cache - DEBUG - Writing data to /Users/petrotiurin/Library/Application Support/firebolt/JG__FqhfFJ-fIbZg_O1xcDiwRJ-Vk1jPnGpPpMMKy8h0jnS179yIl6vfG1hIM8dSkOs8ZiZy6VSjcrD62gWt-imOzPAvxmhSMOFbrSquG5iGCms6SXjQ0UPlUpa4zI0qgf6ncH0Y76TfY7mipq81PZGK69GGfcOFYenkBsoyPgM.txt\n", |
| 124 | + "firebolt.utils.cache - DEBUG - Cache hit in memory\n", |
| 125 | + "firebolt.utils.cache - DEBUG - Setting value in cache\n", |
| 126 | + "firebolt.utils.cache - DEBUG - Writing data to /Users/petrotiurin/Library/Application Support/firebolt/JG__FqhfFJ-fIbZg_O1xcDiwRJ-Vk1jPnGpPpMMKy8h0jnS179yIl6vfG1hIM8dSkOs8ZiZy6VSjcrD62gWt-imOzPAvxmhSMOFbrSquG5iGCms6SXjQ0UPlUpa4zI0qgf6ncH0Y76TfY7mipq81PZGK69GGfcOFYenkBsoyPgM.txt\n", |
| 127 | + "firebolt.utils.cache - DEBUG - Cache hit in memory\n", |
| 128 | + "firebolt.utils.cache - DEBUG - Setting value in cache\n", |
| 129 | + "firebolt.utils.cache - DEBUG - Writing data to /Users/petrotiurin/Library/Application Support/firebolt/JG__FqhfFJ-fIbZg_O1xcDiwRJ-Vk1jPnGpPpMMKy8h0jnS179yIl6vfG1hIM8dSkOs8ZiZy6VSjcrD62gWt-imOzPAvxmhSMOFbrSquG5iGCms6SXjQ0UPlUpa4zI0qgf6ncH0Y76TfY7mipq81PZGK69GGfcOFYenkBsoyPgM.txt\n" |
| 130 | + ] |
| 131 | + } |
| 132 | + ], |
63 | 133 | "source": [ |
64 | 134 | "# create a connection based on provided credentials\n", |
65 | 135 | "connection = connect(\n", |
|
84 | 154 | }, |
85 | 155 | { |
86 | 156 | "cell_type": "code", |
87 | | - "execution_count": null, |
| 157 | + "execution_count": 11, |
88 | 158 | "id": "4bce6586", |
89 | 159 | "metadata": {}, |
90 | | - "outputs": [], |
| 160 | + "outputs": [ |
| 161 | + { |
| 162 | + "name": "stderr", |
| 163 | + "output_type": "stream", |
| 164 | + "text": [ |
| 165 | + "/Users/petrotiurin/Development/firebolt-sdk/src/firebolt/db/connection.py:365: UserWarning: Unclosed <firebolt.db.connection.Connection object at 0x105ad8740>\n", |
| 166 | + " warn(f\"Unclosed {self!r}\", UserWarning)\n", |
| 167 | + "firebolt.utils.cache - DEBUG - Cache hit in memory for key\n", |
| 168 | + "firebolt.utils.cache - DEBUG - Setting value in cache for key\n", |
| 169 | + "firebolt.utils.cache - DEBUG - Writing data to /Users/petrotiurin/Library/Application Support/firebolt/JG__FqhfFJ-fIbZg_O1xcDiwRJ-Vk1jPnGpPpMMKy8h0jnS179yIl6vfG1hIM8dSkOs8ZiZy6VSjcrD62gWt-imOzPAvxmhSMOFbrSquG5iGCms6SXjQ0UPlUpa4zI0qgf6ncH0Y76TfY7mipq81PZGK69GGfcOFYenkBsoyPgM.txt: {\"id\": \"43a03510f62846cbb398449eacb51853\", \"expiry_time\": 1755856645, \"system_engine\": {\"url\": \"https://01hnj9r1xrx3a4t3kb1ec7qs2b.api.us-east-1.staging.firebolt.io\", \"params\": {}}, \"databases\": {\"petro_test\": {\"name\": \"petro_test\"}}, \"engines\": {\"petro_test\": {\"url\": \"https://developer-firebolt.api.us-east-1.staging.firebolt.io\", \"params\": {\"database\": \"petro_test\", \"engine\": \"petro_test\"}}}, \"token\": \"eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCIsImtpZCI6Ik1kMmVfbjlsTlBiSGFPTWJFR3JQZyJ9.eyJodHRwczovL2ZpcmVib2x0LmlvL2NsYWltcyI6eyJjb25uZWN0aW9uX3ByZWZlcmVuY2UiOiJQUkVGRVJfUFVCTElDIiwiZ2xvYmFsX3JvbGVzIjpbIk9SR0FOSVpBVElPTl9BRE1JTiJdLCJpZCI6ImMxNzJkNjJlLWFiM2EtNDVjZS1hYTdkLTA3M2ZlMTRlYzk1NiIsImlzX3N1cHBvcnQiOmZhbHNlLCJvcmdhbml6YXRpb25faWQiOiI5N2FjNzdiZC1iMWY4LTRkNmItOWNkZS02Zjc3ZWVmMWRmODkiLCJvcmdhbml6YXRpb25fbmFtZSI6ImZpcmVib2x0Iiwic2VydmljZV9hY2NvdW50X2lkIjoiYmEzNDcyN2ItMzA1YS00NzM1LTllMTItNDEwMTYwMGM2OTRhIn0sImlzcyI6Imh0dHBzOi8vaWQuc3RhZ2luZy5maXJlYm9sdC5pby8iLCJzdWIiOiJmTjdHcjVjNmxUV3J6RG9sNlJ3eURPbERRVlpGdW9VZEBjbGllbnRzIiwiYXVkIjoiaHR0cHM6Ly9hcGkuZmlyZWJvbHQuaW8iLCJpYXQiOjE3NTU4NTMwNDUsImV4cCI6MTc1NTg2MDI0NSwic2NvcGUiOiJzZXJ2aWNlLWFjY291bnQiLCJndHkiOiJjbGllbnQtY3JlZGVudGlhbHMiLCJhenAiOiJmTjdHcjVjNmxUV3J6RG9sNlJ3eURPbERRVlpGdW9VZCJ9.FHdXEie-c1W6rlsEZaXhD5DoQj8wRFHAhLQBBd7wDQR3uBzHRJOMPnMt6pJuaS3p2FwFeghMu7u3FAYPKz-6qm1QiFOnAapXuAHYZT-_Ft_Pbux0O5dmfP7Vy8DAKW9gpL8djkwg5Hf8LOjzTXPT_iawSZt4reDoG8uokwBpDyqbzqFfsn8bRLEObgbBaPFGLIzR_gLlWvYUKvxcPccykwBjAqmcN2FDRB-9aYetIs6y0C00MYSjzSfOVMH7Y7cVx_SAPooVPmm3gkFJa2FBjYBVNjJz8mm5NJw5_jE7bWQjkrc4bq6O7eNOhmLbIkI7p7QyzNECsnklUUU8hSaoAg\"}\n" |
| 170 | + ] |
| 171 | + }, |
| 172 | + { |
| 173 | + "name": "stdout", |
| 174 | + "output_type": "stream", |
| 175 | + "text": [ |
| 176 | + "Writing to file: /Users/petrotiurin/Library/Application Support/firebolt/JG__FqhfFJ-fIbZg_O1xcDiwRJ-Vk1jPnGpPpMMKy8h0jnS179yIl6vfG1hIM8dSkOs8ZiZy6VSjcrD62gWt-imOzPAvxmhSMOFbrSquG5iGCms6SXjQ0UPlUpa4zI0qgf6ncH0Y76TfY7mipq81PZGK69GGfcOFYenkBsoyPgM.txt\n" |
| 177 | + ] |
| 178 | + }, |
| 179 | + { |
| 180 | + "data": { |
| 181 | + "text/plain": [ |
| 182 | + "0" |
| 183 | + ] |
| 184 | + }, |
| 185 | + "execution_count": 11, |
| 186 | + "metadata": {}, |
| 187 | + "output_type": "execute_result" |
| 188 | + } |
| 189 | + ], |
91 | 190 | "source": [ |
92 | 191 | "cursor.execute(\n", |
93 | 192 | " \"create fact table if not exists test_table (id int, name text, dt datetime) primary index id\"\n", |
|
134 | 233 | }, |
135 | 234 | { |
136 | 235 | "cell_type": "code", |
137 | | - "execution_count": null, |
| 236 | + "execution_count": 12, |
138 | 237 | "id": "71744dc5", |
139 | 238 | "metadata": {}, |
140 | | - "outputs": [], |
| 239 | + "outputs": [ |
| 240 | + { |
| 241 | + "name": "stdout", |
| 242 | + "output_type": "stream", |
| 243 | + "text": [ |
| 244 | + "Description: [Column(name='id', type_code=<class 'int'>, display_size=None, internal_size=None, precision=None, scale=None, null_ok=None), Column(name='name', type_code=<class 'str'>, display_size=None, internal_size=None, precision=None, scale=None, null_ok=None), Column(name='dt', type_code=<class 'datetime.datetime'>, display_size=None, internal_size=None, precision=None, scale=None, null_ok=None)]\n", |
| 245 | + "Rowcount: 3\n" |
| 246 | + ] |
| 247 | + } |
| 248 | + ], |
141 | 249 | "source": [ |
142 | 250 | "cursor.execute(\"select * from test_table\")\n", |
143 | 251 | "print(\"Description: \", cursor.description)\n", |
|
439 | 547 | ], |
440 | 548 | "metadata": { |
441 | 549 | "kernelspec": { |
442 | | - "display_name": "Python 3 Trio", |
| 550 | + "display_name": "venv", |
443 | 551 | "language": "python", |
444 | | - "name": "python3-trio" |
| 552 | + "name": "python3" |
445 | 553 | }, |
446 | 554 | "language_info": { |
447 | 555 | "codemirror_mode": { |
|
453 | 561 | "name": "python", |
454 | 562 | "nbconvert_exporter": "python", |
455 | 563 | "pygments_lexer": "ipython3", |
456 | | - "version": "3.9.20" |
| 564 | + "version": "3.9.19" |
457 | 565 | } |
458 | 566 | }, |
459 | 567 | "nbformat": 4, |
|
0 commit comments