Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

3. Next, you must develop a Python module in a PY file, using object-oriented programming methodology, to enable CRUD functionality for the database. Other

image
image    
imageimageimage

3. Next, you must develop a Python module in a PY file, using object-oriented programming methodology, to enable CRUD functionality for the database. Other Python scripts must be able to import your Python code, so it must support code reusability. Develop a CRUD class that, when instantiated, provides the following functionality: o A Create method that inserts a document into a specified MongoDB database and collection Input -> argument to function should be the key/value lookup pair to use with the MongoDB driver find API call. Return -> "True" if successful insert, else "False". A Read method that queries for document(s) from a specified MongoDB database and specified collection Input -> arguments to function should be the key/value lookup pair to use with the MongoDB driver find API call. Return -> result in a list if the command is successful, else an empty list. Important: Be sure to use find() instead of find_one() when developing your method. Hint: You will have to work with the MongoDB cursor returned by the find() method. o An Update method that queries for and changes document(s) from a specified MongoDB database and specified collection Input -> arguments to function should be the key/value lookup pair to use with the MongoDB driver Find API call. The last argument to function will be a set of key/value pairs in the data type acceptable to the MongoDB driver update_one() or update_many() API call. Return -> The number of objects modified in the collection. o A Delete method that queries for and removes document(s) from a specified MongoDB database and specified collection Input -> arguments to function should be the key/value lookup pair to use with the MongoDB driver find API call. Return -> The number of objects removed from the collection. Be sure to use industry-standard best practices, such as proper naming conventions, exception handling, and in-line comments, as you develop your code. This step ensures that your code is easy to read and reusable for future projects. Refer to the Python Style Guide, located in the Supporting Materials section, to help with these industry-standard best practices. Note: If you completed the Module Four Milestone, you have already developed the Create and Read functionality. 4. Finally, you must test your Python module to make sure it works. To do this testing, create a Python script that imports your CRUD Python module to call and test all instances of CRUD functionality. Be sure to create this script in a separate Jupyter Notebook (IPYNB) file and import and instantiate an object from your CRUD library to effect changes in MongoDB. Be sure to use the username and password for the "aacuser" account for authentication when instantiating the class. After creating your script, execute it in Jupyter Notebook and take screenshots of the commands and their execution. You will include these screenshots in your README file later. Note: If you completed the Module Four Milestone, you have already begun this work. Expand your script to call and test the Update and Delete functionality. README File Grazioso Salvare has requested documentation to accompany the CRUD Python module. This documentation will ensure they can understand the work completed. It will also help them to maintain the code for the database. To document this project, you must create a README file that includes the following: An explanation of the purpose of the CRUD Python module An explanation of how the module should be used, including: o A description of the Python driver for Mongo that was used and why it was chosen An explanation of the attributes and working functionality of the CRUD operations . A demonstration of the module's functional operations, including: o Screenshots of the MongoDB import execution. You took these screenshots in Step 1. o Screenshots of the user authentication execution. You took these screenshots in Step 2. o Screenshots of the CRUD functionality test execution. You took these screenshots in Step 4. Note: If you completed the Module Four Milestone, you have already begun work on your README file. You will need to add more information to complete your README file and fully document your work in Project One. What to Submit To complete this project, you must submit the following: Database Commands and CRUD Python Module Submit the IPYNB and PY files containing your code for the project. This code includes the Python module you developed to enable all CRUD functionality and the Python script that calls that functionality. All code files should follow industry-standard best practices, including well- commented code. README File Your submission should be a Word (DOC or DOCX) file containing an explanation of the Python module that you developed to enable CRUD functionality. Be sure to include all required screenshots in your README file. norvenskyfran_snhu@nv-snhu7-l01: /usr/local/datasets A (base) norvenskyfran_snhu@nv-snhu7-101:/usr/local/datasets $ mongoimport --username="${MONGO_USER }" --password="${MONGO_PASS}" --port=${MONGO_PORT] --host=${MONGO_HOST} --db AAC --collection an imals --authentication Database admin --drop ./aac_shelter_outcomes.csv --type csv --headerline 2023-08-06T06:21:18.854+0000 2023-08-06T06:21:18.855+0000 2023-08-06T06:21:19.937+0000 Q import. (base) norvenskyfran_snhu@nv-snhu7-101:/usr/local/datasets $ = 0 connected to: mongodb://nv-desktop-services.apporto.com:30821/ dropping: AAC.animals 10000 document(s) imported successfully. 0 document(s) failed to mongosh mongodb:// @nv-desktop-serv... Enter password AAC> switched to db AAC AAC> db.createUser({user:"aacuser", pwd: password Prompt(), roles:[{role: readwrite", db: "AAC"}]}) ***{ ok: 1 } ||| x A norvenskyfran_snhu@nv-snhu7-101: /usr/local/datasets (base) user norvenskyfran_snhu@nv-snhu7-101:/usr/local/datasets$ (base) norvenskyfran_snhu@nv-snhu7-101:/usr/local/datasets $ ella2018 (base) norvenskyfran_snhu@nv-snhu7-101:/usr/local/datasets$ p - i mongo MONGO_USER=aacuser MONGO_HOST=nv-desktop-services.apporto.com ||| MONGO_PASS=norella2018 MONGO_PORT=30821 (base) norvenskyfran_snhu@nv-snhu7-101:/usr/local/datasets$ MONGO_USER=aac MONGO_PASS=nor printenv | gre

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Investments An Introduction

Authors: Herbert B. Mayo

12th edition

1305638417, 978-1337430937, 1337430935, 978-1305638419

More Books

Students also viewed these Programming questions

Question

What are the differences between a while and do/while statement?

Answered: 1 week ago