3. Next, you must develop a Python module in a PY file, using object-oriented programming methodology,...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
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 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
Expert Answer:
Related Book For
Posted Date:
Students also viewed these programming questions
-
Develop a Python module in a PY file, using object-oriented programming methodology, to enable create and read functionality for the database. To support code reusability, your Python code needs to...
-
Design a Java class that represents a cache with a fixed size. It should support operations like add, retrieve, and remove, and it should evict the least recently used item when it reaches capacity.
-
In a recent year, the total scores for a certain standardized test were normally distributed, with a mean of 500 and a standard deviation of 10.4. Answer parts (a)-(d) below. (a) Find the probability...
-
Which of the following statements is true if the NPV of a project is - $4,000 (negative $4,000) and the required rate of return is 5 percent? a. The project's IRR is less than 5 percent. b. The...
-
Determine which ordered pairs satisfy the given equation. 3x - 5y = 15 (0, -3) (5, 0) (-3, 5)
-
A process for the manufacturer of 4-by-8-foot woodgrained panels has performed in the past with an average of 2.7 imperfections per 100 panels. Construct a chart to be used in the inspection of the...
-
Alternative Distributor Corp., a distributor of groceries and related products, is headquartered in Medford, Massachusetts. During a recent audit, Alternative Distributor Corp. was advised that...
-
Vaughn Corporation has 73,000 shares of common stock outstanding. It declares a $2 per share cash dividend on November 1 to stockholders of record on December 1. The dividend is paid on December 31....
-
A retail outlet sells holiday candy for $10 per bag. The cost of the product is $8 per bag. All units not sold during the selling season prior to the holiday are sold for half the retail price in a...
-
1) Define the concept of Quality 2) Define the concept of Reliability and further discuss the 3 main parts of the definition (perform as intended, specified time and life cycle conditions) 3) Present...
-
Let : R R ' be a ring homomorphism. Prove that I is an ideal of R then ( I ) is an ideal of ( R ) .
-
Starbucks Discussion Prompt(s) If you had to make a business decision for the company you are evaluating and only had access to one of the financial statements - income statement, balance sheet,...
-
Evaluate the following expression. 6! 3! 3!
-
2) Write as a single logarithm & explain your steps. (4 marks each) a) log7 8+ log74 - log7 16
-
Read the attached case study, and submit your review of the following: 'Defining Standard Projects at Global Green Books Publishing' Make sure to follow the formatting requirements detailed in the...
-
A transverse sinusoidal pulse travels along a string in the +x direction with a speed of 10.0 m/s and a wavelength of 2.50 m. The pulse has an amplitude of 2.00 cm. If the element of the string at x...
-
Does log 81 (2401) = log 3 (7)? Verify the claim algebraically.
-
What are the differences between a closed-end investment company and a mutual fund? What are the sources of return from an investment in a closed-end investment company?
-
The price of DHM stock is $192 and the following call and put options are actively traded. You decide to analyze the following strategies: Buy the calls to buy the stock at $180 and $210 and sell the...
-
What is the difference between the following? a) The indenture and the trustee b) The coupon rate and the current rate of interest c) Debentures and secured bonds d) A sinking fund and a call feature...
-
Explain the term Energy. Discuss its various forms.
-
Explain cyclic and quasi static process.
-
Explain the terms : state, phase, process and cyclic process.
Study smarter with the SolutionInn App