From ea1c38064afc251c7b99714de6c54cdde67f9046 Mon Sep 17 00:00:00 2001 From: Mudesir Suleyman Date: Tue, 11 Aug 2020 02:41:43 -0700 Subject: [PATCH 1/3] SQL Ass --- module1-introduction-to-sql/rpg_db_example.py | 40 ++++++++++++++++++ module1-introduction-to-sql/test_db.sqlite3 | Bin 0 -> 8192 bytes 2 files changed, 40 insertions(+) create mode 100644 module1-introduction-to-sql/rpg_db_example.py create mode 100644 module1-introduction-to-sql/test_db.sqlite3 diff --git a/module1-introduction-to-sql/rpg_db_example.py b/module1-introduction-to-sql/rpg_db_example.py new file mode 100644 index 00000000..fa0abb5e --- /dev/null +++ b/module1-introduction-to-sql/rpg_db_example.py @@ -0,0 +1,40 @@ +import sqlite3 + + +def connect_to_db(db_name='rpg_db.sqlite3'): + return sqlite3.connect(db_name) +def execute_query(cursor, query): + cursor.execute(query) + return cursor.fetchall() + +GET_CHARACTERS = """ + SELECT * + FROM charactercreator_character; +""" + +GET_SUBCLASS = """ + SELECT COUNT(*) FROM charactercreator_character; + """ +GET_ITEMS = """ + SELECT COUNT(DISTINCT name) FROM charactercreator_character; + """ + +if __name__ == '__main__': + conn = connect_to_db() + curs = conn.cursor() + results = execute_query(curs, GET_CHARACTERS) + print(results) + x = len(results) + print(x) + + results2 = execute_query(curs, GET_SUBCLASS) + print(results2) + y = len(results2) + print(y) + + results3 = execute_query(curs, GET_ITEMS) + print(results3) + z = len(results3) + print(z) + + diff --git a/module1-introduction-to-sql/test_db.sqlite3 b/module1-introduction-to-sql/test_db.sqlite3 new file mode 100644 index 0000000000000000000000000000000000000000..8264dd1c05aa980462c62ff39ef9ad1f3f915fbd GIT binary patch literal 8192 zcmeI#u?oU45C-78D&it_u(;mXf{5s@R_P*L)V@HJXbZN5ng{eXe38zk+FfvR_>WvJ zIT8Zjmg7FojFwAT<;uu{hQv&35h8NhwB;Ra=We@hO0)kK4oz3jfj!0UgX};+00Izz z00bZa0SG_<0uX=z1R(H(z><4o&tqlO>86don+|w zf{CcBmaH(r=Wkw Date: Wed, 17 Feb 2021 21:57:09 -0800 Subject: [PATCH 2/3] work on assignment sql on py --- module1-introduction-to-sql/query.py | 96 +++++++++++++++++++ .../rgb_db_assignment.py | 24 +++++ 2 files changed, 120 insertions(+) create mode 100644 module1-introduction-to-sql/query.py create mode 100644 module1-introduction-to-sql/rgb_db_assignment.py diff --git a/module1-introduction-to-sql/query.py b/module1-introduction-to-sql/query.py new file mode 100644 index 00000000..44bd7edf --- /dev/null +++ b/module1-introduction-to-sql/query.py @@ -0,0 +1,96 @@ +# Define query +# How many total characters are there +GET_CHARACTERS = """ + SELECT COUNT(*) AS Total_Char + FROM charactercreator_character; + +""" +# How many of each specific subclass? +GET_CHARACTER_SUBCLASS = """ + SELECT COUNT(DISTINCT(name)) AS sub_class + FROM charactercreator_character; + +""" +# How many total Items? +GET_TOTAL_ITEMS = """ + SELECT COUNT(*) AS Total_Items + FROM armory_item; +""" +# How many of the Items are weapons? +GET_ITEMS_ARE_WEAPONS = """ + SELECT COUNT(item_id) AS items_weapons + FROM armory_item AS ai + LEFT JOIN armory_weapon AS aw + ON aw.item_ptr_id = ai.item_id; +""" +# How many are not? +GET_ITEMS_ARE_NOT_WEAPONS = """ + SELECT COUNT(*) AS items_not_weapons + FROM armory_item AS ai + INNER JOIN armory_weapon AS aw + ON aw.item_ptr_id != ai.item_id; +""" +# How many Items does each character have? (Return first 20 rows) +GET_ITEMS_PER_CHARACTER = """ + SELECT + cc.character_id, + COUNT(DISTINCT ai.item_id) AS item_per_character + FROM charactercreator_character AS cc + LEFT JOIN charactercreator_character_inventory AS ci + ON cc.character_id = ci.character_id + LEFT JOIN armory_item AS ai + ON ci.item_id = ai.item_id + GROUP BY cc.character_id + LIMIT 20 + +""" +# How many Weapons does each character have? (Return first 20 rows) +GET_ITEMS_PER_CHARACTER = """ + SELECT + cc.character_id, + COUNT(DISTINCT aw.item_ptr_id) AS weapon_per_character + FROM charactercreator_character AS cc + LEFT JOIN charactercreator_character_inventory AS ci + ON cc.character_id = ci.character_id + LEFT JOIN armory_weapon AS aw + ON ci.item_id = aw.item_ptr_id + GROUP BY cc.character_id + LIMIT 20 + +""" +# On average, how many Items does each character have? +GET_ITEMS_PER_CHARACTER = """ + SELECT AVG(item_per_character) AS avg_weapon_per_char + FROM ( + SELECT + cc.character_id, + COUNT(DISTINCT ai.item_id) AS item_per_character + FROM charactercreator_character AS cc + LEFT JOIN charactercreator_character_inventory AS ci + ON cc.character_id = ci.character_id + LEFT JOIN armory_item AS ai + ON ci.item_id = ai.item_id + GROUP BY cc.character_id + + ) +""" +# On average, how many Weapons does each character have? +GET_WEAPON_PER_CHARACTER = """ + SELECT AVG(weapon_count) AS avg_weapon_per_char + FROM ( + SELECT + cc.character_id, + COUNT(DISTINCT aw.item_ptr_id) AS weapon_count + FROM charactercreator_character AS cc + LEFT JOIN charactercreator_character_inventory AS ci + ON cc.character_id = ci.character_id + LEFT JOIN armory_weapon AS aw + ON ci.item_id = aw.item_ptr_id + GROUP BY cc.character_id + + ) subq +""" + +QUERY_LIST = [GET_CHARACTERS, GET_CHARACTER_NAMES, GET_CHARACTER_SUBCLASS, + GET_ITEMS, GET_ITEMS_ARE_NOT_WEAPONS, GET_ITEMS_ARE_WEAPONS, + GET_ITEMS_PER_CHARACTER, GET_SUBCLASS, GET_TOTAL_ITEMS, GET_WEAPON_PER_CHARACTER] \ No newline at end of file diff --git a/module1-introduction-to-sql/rgb_db_assignment.py b/module1-introduction-to-sql/rgb_db_assignment.py new file mode 100644 index 00000000..17c2b639 --- /dev/null +++ b/module1-introduction-to-sql/rgb_db_assignment.py @@ -0,0 +1,24 @@ +# +import sqlite3 +from query import * +# connect the databse +def connect_to_db(db_name="rpg_db.sqlite3"): + return sqlite3.connect(db_name) + +def execute_query(cursor, query): + cursor.execute(query) + return cursor.fetchall() + + +if __name__ == "__main__": + # connect to DB + conn = connect_to_db() + # Create Cursor + curs = conn.cursor() + # Execute query + result1 = execute_query(curs, query.GET_CHARACTERS) + print(result1[0]) + result2 = execute_query(curs, query.GET_CHARACTER_SUBCLASS) + print(result2[0]) + result3 = execute_query(curs, query.GET_WEAPON_PER_CHARACTER) + print(result3[0]) \ No newline at end of file From ff03ffe31fb9f456adb8089a9cc18aaedd2197bf Mon Sep 17 00:00:00 2001 From: Mudesir Suleyman Date: Thu, 18 Feb 2021 16:34:00 -0800 Subject: [PATCH 3/3] work on assignment 2 --- .gitignore | 2 + Pipfile | 11 ++ module1-introduction-to-sql/Pipfile | 15 ++ module1-introduction-to-sql/Pipfile.lock | 148 ++++++++++++++++++ .../elephant_queries.py | 21 +++ .../Pipfile | 11 ++ .../elephant_queries.py | 17 ++ rpg_db.sqlite3 | 0 8 files changed, 225 insertions(+) create mode 100644 Pipfile create mode 100644 module1-introduction-to-sql/Pipfile create mode 100644 module1-introduction-to-sql/Pipfile.lock create mode 100644 module1-introduction-to-sql/elephant_queries.py create mode 100644 module3-nosql-and-document-oriented-databases/Pipfile create mode 100644 module3-nosql-and-document-oriented-databases/elephant_queries.py create mode 100644 rpg_db.sqlite3 diff --git a/.gitignore b/.gitignore index 894a44cc..d5110b05 100644 --- a/.gitignore +++ b/.gitignore @@ -102,3 +102,5 @@ venv.bak/ # mypy .mypy_cache/ + + diff --git a/Pipfile b/Pipfile new file mode 100644 index 00000000..5d44a488 --- /dev/null +++ b/Pipfile @@ -0,0 +1,11 @@ +[[source]] +url = "https://pypi.python.org/simple" +verify_ssl = true +name = "pypi" + +[packages] + +[dev-packages] + +[requires] +python_version = "3.8" diff --git a/module1-introduction-to-sql/Pipfile b/module1-introduction-to-sql/Pipfile new file mode 100644 index 00000000..498d0c2c --- /dev/null +++ b/module1-introduction-to-sql/Pipfile @@ -0,0 +1,15 @@ +[[source]] +url = "https://pypi.python.org/simple" +verify_ssl = true +name = "pypi" + +[packages] +python-dotenv = "*" +psycopg2-binary = "*" +pymongo = "*" +dnspython = "*" + +[dev-packages] + +[requires] +python_version = "3.8" diff --git a/module1-introduction-to-sql/Pipfile.lock b/module1-introduction-to-sql/Pipfile.lock new file mode 100644 index 00000000..8b44ddb1 --- /dev/null +++ b/module1-introduction-to-sql/Pipfile.lock @@ -0,0 +1,148 @@ +{ + "_meta": { + "hash": { + "sha256": "849d0e5a49239ac4ef72d4b7a6cd9038e31e6b738cc62caf25c5a0c7d3348072" + }, + "pipfile-spec": 6, + "requires": { + "python_version": "3.8" + }, + "sources": [ + { + "name": "pypi", + "url": "https://pypi.python.org/simple", + "verify_ssl": true + } + ] + }, + "default": { + "dnspython": { + "hashes": [ + "sha256:95d12f6ef0317118d2a1a6fc49aac65ffec7eb8087474158f42f26a639135216", + "sha256:e4a87f0b573201a0f3727fa18a516b055fd1107e0e5477cded4a2de497df1dd4" + ], + "index": "pypi", + "version": "==2.1.0" + }, + "psycopg2-binary": { + "hashes": [ + "sha256:0deac2af1a587ae12836aa07970f5cb91964f05a7c6cdb69d8425ff4c15d4e2c", + "sha256:0e4dc3d5996760104746e6cfcdb519d9d2cd27c738296525d5867ea695774e67", + "sha256:11b9c0ebce097180129e422379b824ae21c8f2a6596b159c7659e2e5a00e1aa0", + "sha256:15978a1fbd225583dd8cdaf37e67ccc278b5abecb4caf6b2d6b8e2b948e953f6", + "sha256:1fabed9ea2acc4efe4671b92c669a213db744d2af8a9fc5d69a8e9bc14b7a9db", + "sha256:2dac98e85565d5688e8ab7bdea5446674a83a3945a8f416ad0110018d1501b94", + "sha256:42ec1035841b389e8cc3692277a0bd81cdfe0b65d575a2c8862cec7a80e62e52", + "sha256:6422f2ff0919fd720195f64ffd8f924c1395d30f9a495f31e2392c2efafb5056", + "sha256:6a32f3a4cb2f6e1a0b15215f448e8ce2da192fd4ff35084d80d5e39da683e79b", + "sha256:7312e931b90fe14f925729cde58022f5d034241918a5c4f9797cac62f6b3a9dd", + "sha256:7d92a09b788cbb1aec325af5fcba9fed7203897bbd9269d5691bb1e3bce29550", + "sha256:833709a5c66ca52f1d21d41865a637223b368c0ee76ea54ca5bad6f2526c7679", + "sha256:89705f45ce07b2dfa806ee84439ec67c5d9a0ef20154e0e475e2b2ed392a5b83", + "sha256:8cd0fb36c7412996859cb4606a35969dd01f4ea34d9812a141cd920c3b18be77", + "sha256:950bc22bb56ee6ff142a2cb9ee980b571dd0912b0334aa3fe0fe3788d860bea2", + "sha256:a0c50db33c32594305b0ef9abc0cb7db13de7621d2cadf8392a1d9b3c437ef77", + "sha256:a0eb43a07386c3f1f1ebb4dc7aafb13f67188eab896e7397aa1ee95a9c884eb2", + "sha256:aaa4213c862f0ef00022751161df35804127b78adf4a2755b9f991a507e425fd", + "sha256:ac0c682111fbf404525dfc0f18a8b5f11be52657d4f96e9fcb75daf4f3984859", + "sha256:ad20d2eb875aaa1ea6d0f2916949f5c08a19c74d05b16ce6ebf6d24f2c9f75d1", + "sha256:b4afc542c0ac0db720cf516dd20c0846f71c248d2b3d21013aa0d4ef9c71ca25", + "sha256:b8a3715b3c4e604bcc94c90a825cd7f5635417453b253499664f784fc4da0152", + "sha256:ba28584e6bca48c59eecbf7efb1576ca214b47f05194646b081717fa628dfddf", + "sha256:ba381aec3a5dc29634f20692349d73f2d21f17653bda1decf0b52b11d694541f", + "sha256:bd1be66dde2b82f80afb9459fc618216753f67109b859a361cf7def5c7968729", + "sha256:c2507d796fca339c8fb03216364cca68d87e037c1f774977c8fc377627d01c71", + "sha256:cec7e622ebc545dbb4564e483dd20e4e404da17ae07e06f3e780b2dacd5cee66", + "sha256:d14b140a4439d816e3b1229a4a525df917d6ea22a0771a2a78332273fd9528a4", + "sha256:d1b4ab59e02d9008efe10ceabd0b31e79519da6fb67f7d8e8977118832d0f449", + "sha256:d5227b229005a696cc67676e24c214740efd90b148de5733419ac9aaba3773da", + "sha256:e1f57aa70d3f7cc6947fd88636a481638263ba04a742b4a37dd25c373e41491a", + "sha256:e74a55f6bad0e7d3968399deb50f61f4db1926acf4a6d83beaaa7df986f48b1c", + "sha256:e82aba2188b9ba309fd8e271702bd0d0fc9148ae3150532bbb474f4590039ffb", + "sha256:ee69dad2c7155756ad114c02db06002f4cded41132cc51378e57aad79cc8e4f4", + "sha256:f5ab93a2cb2d8338b1674be43b442a7f544a0971da062a5da774ed40587f18f5" + ], + "index": "pypi", + "version": "==2.8.6" + }, + "pymongo": { + "hashes": [ + "sha256:0384d76b409278ddb34ac19cdc4664511685959bf719adbdc051875ded4689aa", + "sha256:05e2bda928a3a6bc6ddff9e5a8579d41928b75d7417b18f9a67c82bb52150ac6", + "sha256:152e4ac3158b776135d8fce28d2ac06e682b885fcbe86690d66465f262ab244e", + "sha256:180511abfef70feb022360b35f4863dd68e08334197089201d5c52208de9ca2e", + "sha256:19d52c60dc37520385f538d6d1a4c40bc398e0885f4ed6a36ce10b631dab2852", + "sha256:1d559a76ae87143ad96c2ecd6fdd38e691721e175df7ced3fcdc681b4638bca1", + "sha256:210ec4a058480b9c3869082e52b66d80c4a48eda9682d7a569a1a5a48100ea54", + "sha256:2163d736d6f62b20753be5da3dc07a188420b355f057fcbb3075b05ee6227b2f", + "sha256:22ee2c94fee1e391735be63aa1c9af4c69fdcb325ae9e5e4ddff770248ef60a6", + "sha256:28633868be21a187702a8613913e13d1987d831529358c29fc6f6670413df040", + "sha256:29390c39ca873737689a0749c9c3257aad96b323439b11279fbc0ba8626ec9c5", + "sha256:2aeb108da1ed8e066800fb447ba5ae89d560e6773d228398a87825ac3630452d", + "sha256:322f6cc7bf23a264151ebc5229a92600c4b55ac83c83c91c9bab1ec92c888a8d", + "sha256:34c15f5798f23488e509eae82fbf749c3d17db74379a88c07c869ece1aa806b9", + "sha256:3873866534b6527e6863e742eb23ea2a539e3c7ee00ad3f9bec9da27dbaaff6f", + "sha256:3dbc67754882d740f17809342892f0b24398770bd99d48c5cb5ba89f5f5dee4e", + "sha256:413b18ac2222f5d961eb8d1c8dcca6c6ca176c8613636d8c13aa23abae7f7a21", + "sha256:42f9ec9d77358f557fe17cc15e796c4d4d492ede1a30cba3664822cae66e97c5", + "sha256:4ac387ac1be71b798d1c372a924f9c30352f30e684e06f086091297352698ac0", + "sha256:4ca92e15fcf02e02e7c24b448a16599b98c9d0e6a46cd85cc50804450ebf7245", + "sha256:4d959e929cec805c2bf391418b1121590b4e7d5cb00af7b1ba521443d45a0918", + "sha256:5091aacbdb667b418b751157f48f6daa17142c4f9063d58e5a64c90b2afbdf9a", + "sha256:5a03ae5ac85b04b2034a0689add9ff597b16d5e24066a87f6ab0e9fa67049156", + "sha256:5e1341276ce8b7752db9aeac6bbb0cbe82a3f6a6186866bf6b4906d8d328d50b", + "sha256:6043d251fac27ca04ff22ed8deb5ff7a43dc18e8a4a15b4c442d2a20fa313162", + "sha256:610d5cbbfd026e2f6d15665af51e048e49b68363fedece2ed318cc8fe080dd94", + "sha256:622a5157ffcd793d305387c1c9fb94185f496c8c9fd66dafb59de0807bc14ad7", + "sha256:65b67637f0a25ac9d25efb13c1578eb065870220ffa82f132c5b2d8e43ac39c3", + "sha256:66573c8c7808cce4f3b56c23cb7cad6c3d7f4c464b9016d35f5344ad743896d7", + "sha256:66b688fc139c6742057795510e3b12c4acbf90d11af1eff9689a41d9c84478d6", + "sha256:685b884fa41bd2913fd20af85866c4ff886b7cbb7e4833b918996aa5d45a04be", + "sha256:6a5834e392c97f19f36670e34bf9d346d733ad89ee0689a6419dd737dfa4308a", + "sha256:728313cc0d59d1a1a004f675607dcf5c711ced3f55e75d82b3f264fd758869f3", + "sha256:733e1cfffc4cd99848230e2999c8a86e284c6af6746482f8ad2ad554dce14e39", + "sha256:7814b2cf23aad23464859973c5cd2066ca2fd99e0b934acefbb0b728ac2525bf", + "sha256:7c77801620e5e75fb9c7abae235d3cc45d212a67efa98f4972eef63e736a8daa", + "sha256:7cd42c66d49ffb68dea065e1c8a4323e7ceab386e660fee9863d4fa227302ba9", + "sha256:7d2ae2f7c50adec20fde46a73465de31a6a6fbb4903240f8b7304549752ca7a1", + "sha256:7edff02e44dd0badd749d7342e40705a398d98c5d8f7570f57cff9568c2351fa", + "sha256:87981008d565f647142869d99915cc4760b7725858da3d39ecb2a606e23f36fd", + "sha256:92e2376ce3ca0e3e443b3c5c2bb5d584c7e59221edfb0035313c6306049ba55a", + "sha256:950710f7370613a6bfa2ccd842b488c5b8072e83fb6b7d45d99110bf44651d06", + "sha256:980527f4ccc6644855bb68056fe7835da6d06d37776a52df5bcc1882df57c3db", + "sha256:9fbffc5bad4df99a509783cbd449ed0d24fcd5a450c28e7756c8f20eda3d2aa5", + "sha256:a8b02e0119d6ee381a265d8d2450a38096f82916d895fed2dfd81d4c7a54d6e4", + "sha256:b17e627844d86031c77147c40bf992a6e1114025a460874deeda6500d0f34862", + "sha256:b1aa62903a2c5768b0001632efdea2e8da6c80abdd520c2e8a16001cc9affb23", + "sha256:b32e4eed2ef19a20dfb57698497a9bc54e74efb2e260c003e9056c145f130dc7", + "sha256:b44fa04720bbfd617b6aef036989c8c30435f11450c0a59136291d7b41ed647f", + "sha256:b4535d98df83abebb572035754fb3d4ad09ce7449375fa09fa9ede2dbc87b62b", + "sha256:bb6a5777bf558f444cd4883d617546182cfeff8f2d4acd885253f11a16740534", + "sha256:bc2eb67387b8376120a2be6cba9d23f9d6a6c3828e00fb0a64c55ad7b54116d1", + "sha256:bd351ceb2decd23d523fc50bad631ee9ae6e97e7cdc355ce5600fe310484f96e", + "sha256:bf70097bd497089f1baabf9cbb3ec4f69c022dc7a70c41ba9c238fa4d0fff7ab", + "sha256:c7fd18d4b7939408df9315fedbdb05e179760960a92b3752498e2fcd03f24c3d", + "sha256:cc359e408712faf9ea775f4c0ec8f2bfc843afe47747a657808d9595edd34d71", + "sha256:cd8fc35d4c0c717cc29b0cb894871555cb7137a081e179877ecc537e2607f0b9", + "sha256:daa44cefde19978af57ac1d50413cd86ebf2b497328e7a27832f5824bda47439", + "sha256:db5098587f58fbf8582d9bda2462762b367207246d3e19623782fb449c3c5fcc", + "sha256:db6fd53ef5f1914ad801830406440c3bfb701e38a607eda47c38adba267ba300", + "sha256:e1414599a97554d451e441afb362dbee1505e4550852c0068370d843757a3fe2", + "sha256:ee42a8f850143ae7c67ea09a183a6a4ad8d053e1dbd9a1134e21a7b5c1bc6c73", + "sha256:f23abcf6eca5859a2982beadfb5111f8c5e76e30ff99aaee3c1c327f814f9f10", + "sha256:f6748c447feeadda059719ef5ab1fb9d84bd370e205b20049a0e8b45ef4ad593" + ], + "index": "pypi", + "version": "==3.11.3" + }, + "python-dotenv": { + "hashes": [ + "sha256:0c8d1b80d1a1e91717ea7d526178e3882732420b03f08afea0406db6402e220e", + "sha256:587825ed60b1711daea4832cf37524dfd404325b7db5e25ebe88c495c9f807a0" + ], + "index": "pypi", + "version": "==0.15.0" + } + }, + "develop": {} +} diff --git a/module1-introduction-to-sql/elephant_queries.py b/module1-introduction-to-sql/elephant_queries.py new file mode 100644 index 00000000..c61c80cf --- /dev/null +++ b/module1-introduction-to-sql/elephant_queries.py @@ -0,0 +1,21 @@ + +import os +from dotenv import load_dotenv +import psycopg2 + + +DB_NAME = os.getenv("DB_NAME") +DB_USER = os.getenv("DB_USER") +DB_PASSWORD = os.getenv("DB_PASSWORD") +DB_HOST = os.getenv("DB_HOST") + +connection = psycopg2.connect(dbname=DB_NAME, user=DB_USER, password=DB_PASSWORD, host=DB_HOST) + +cursor = connection.cursor() +print("CONNECTION", connection) + +cursor.execute('SELECT * from test_table;') +print("CURSOR", cursor) + +result = cursor.fetchall() +print(result) diff --git a/module3-nosql-and-document-oriented-databases/Pipfile b/module3-nosql-and-document-oriented-databases/Pipfile new file mode 100644 index 00000000..5d44a488 --- /dev/null +++ b/module3-nosql-and-document-oriented-databases/Pipfile @@ -0,0 +1,11 @@ +[[source]] +url = "https://pypi.python.org/simple" +verify_ssl = true +name = "pypi" + +[packages] + +[dev-packages] + +[requires] +python_version = "3.8" diff --git a/module3-nosql-and-document-oriented-databases/elephant_queries.py b/module3-nosql-and-document-oriented-databases/elephant_queries.py new file mode 100644 index 00000000..88afb824 --- /dev/null +++ b/module3-nosql-and-document-oriented-databases/elephant_queries.py @@ -0,0 +1,17 @@ + +import psycopg2 + +DB_NAME = 'DS 23.DB' +DB_USER = 'tlrztomk' +DB_PASSWORD = 'bc7MwOEWu6dNtmiBc8Cn8vbXCMOttZst' +DB_HOST = 'ziggy.db.elephantsql.com' +connection = psycopg2.connect(dbname=DB_NAME, user=DB_USER, password=DB_PASSWORD, host=DB_HOST) + +cursor = connection.cursor() +print("CONNECTION", connection) + +cursor.execute('SELECT * from test_table;') +print("CURSOR", cursor) + +result = cursor.fetchall() +print(result) diff --git a/rpg_db.sqlite3 b/rpg_db.sqlite3 new file mode 100644 index 00000000..e69de29b