Refer to the exhibit.
What does this Python script do?
Refer to the exhibit.
What does this Python script do?
This Python script reads the username for a specific IP address from a light (SQLite) database. It connects to the SQLite database, creates a cursor object to execute SQL commands, constructs and executes a query to select the user from the monitor_branch table where the loopback IP matches a specified IP address, fetches the result, and processes the retrieved username. The script only reads the data and does not perform any write operations on the database.
WTF is this a Cisco or SQL exam
They think we're not worthy of the certificate if we do answer this question
Thats my biggest gripe with the new CCNP. It's all BS Cloud/WiFi/Automation. WHAT HAPPENED TO REAL LAYER 1 2 3 NETWORKING
I've recertified my ccnp since 2013 a few times, but now Cisco all of a sudden is going off in such a different direction. Switching and routing is now such a small part of the overall requirements.
tell me about it!
WTF are they serious?
Can't understand?
No- how are you supposed to if you don't regularly use Python and the SQLite module?
Here's a breakdown of what each part does: -1 Importing sqlite3: This line imports the SQLite3 module in Python, allowing the script to interact with SQLite databases. -2 Connecting to the database: The script connects to a SQLite3 database located at /home/sdwan-lab/user.sqlite3. This is done using the connect() method of the sqlite3 module, which returns a connection object (a in this case). -3 Creating a cursor object: Cursors are used to execute SQL queries on the connected database. The cursor() method creates a cursor object (b in this case) associated with the connection
no clue ... didn't see this coming , not in OCG
- 4 SQL Query: The variable c contains an SQL query. It appears to be selecting the user column from a table named monitor_branch where the loopbackip matches a specific pattern. However, there seems to be a syntax error in the query. The string concatenation is not done properly. - 5 Executing the query: The execute() method of the cursor b executes the SQL query stored in the variable c. - 6 Fetching the results: The fetchall() method retrieves all the rows returned by the query execution and stores them in the variable e. - 7 Processing the result: The script then appears to be manipulating the fetched result. It converts the first element of the result (e[0]) to a string, removes any occurrences of ( and ,) from the string, and assigns the modified string back to the variable usr.
Thankyou
B is correct The keyword is: c = "select user from monitor branch where loopbackip='" + str(ip[i]) + "'"
...........................
I'm 50/50 with it being B or C. The two lines for .... usr = usr.replace() ...functions, are for writing. - I honestly just hope I don't see this question :-/
Re-visiting - I'm leaning to B now for read. The replace looks like it's only replacing the special characters.
B: good link here for similar queries from sqlite3 DB. https://pyneng.readthedocs.io/en/latest/book/25_db/sqlite3_fetch.html
B seems to be correct, because data only needs to be read from the DB, and not altered. https://www.google.com/amp/s/www.geeksforgeeks.org/how-to-list-tables-using-sqlite3-in-python/amp/
Definitely 'B'. After getting the username from e[0] it removes the ( and ) chars from string. (nothing written back to DB)
i'm going with B, no idea why :D
doesn the usr.replace string write the username back to the DB once it selects it from the table monitor_Branch?