Skip to content

Commit 91953cd

Browse files
committed
Update the ReadMe
1 parent 518594e commit 91953cd

File tree

1 file changed

+15
-15
lines changed

1 file changed

+15
-15
lines changed

README.md

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -626,36 +626,36 @@ Let's say you have a test that needs to access the database. First make sure you
626626

627627
```python
628628
from seleniumbase.core.mysql import DatabaseManager
629-
def write_data_to_db(self, theId, theValue, theUrl):
629+
def write_data_to_db(self, the_id, the_value, the_url):
630630
db = DatabaseManager()
631-
query = """INSERT INTO myTable(theId,theValue,theUrl)
632-
VALUES (%(theId)s,%(theValue)s,%(theUrl)s)"""
633-
db.execute_query_and_close(query, {"theId":theId,
634-
"theValue":theValue,
635-
"theUrl":theUrl})
631+
query = """INSERT INTO myTable(the_id,the_value,the_url)
632+
VALUES (%(the_id)s,%(the_value)s,%(the_url)s)"""
633+
db.execute_query_and_close(query, {"the_id":the_id,
634+
"the_value":the_value,
635+
"the_url":the_url})
636636
```
637637

638638
Access credentials are stored in [settings.py](https://github.com/seleniumbase/SeleniumBase/blob/master/seleniumbase/config/settings.py) for your convenience (you have to add them first).
639639

640-
The following example below (taken from the Delayed Data Manager) shows how data can be pulled from the database.
640+
The following example below (taken from the Delayed Test Data Manager) shows how data can be pulled from the database.
641641

642642
```python
643643
import logging
644644
from seleniumbase.core.mysql import DatabaseManager
645645

646-
def get_delayed_test_data(self, testcase_address, done=0):
646+
def get_delayed_test_data(self, test_address, is_done=0):
647647
""" Returns a list of rows """
648648
db = DatabaseManager()
649-
query = """SELECT guid,testcaseAddress,insertedAt,expectedResult,done
650-
FROM delayedTestData
651-
WHERE testcaseAddress=%(testcase_address)s
652-
AND done=%(done)s"""
653-
data = db.fetchall_query_and_close(query, {"testcase_address":testcase_address, "done":done})
649+
query = """SELECT guid,test_address,inserted_at,expected_result,is_done
650+
FROM delayed_test_data
651+
WHERE test_address=%(test_address)s
652+
AND is_done=%(is_done)s"""
653+
data = db.fetchall_query_and_close(query, {"test_address":test_address, "is_done":is_done})
654654
if data:
655655
return data
656656
else:
657-
logging.debug("Could not find any rows in delayedTestData.")
658-
logging.debug("DB Query = " + query % {"testcase_address":testcase_address, "done":done})
657+
logging.debug("Could not find any rows in delayed_test_data.")
658+
logging.debug("DB Query = " + query % {"test_address":test_address, "is_done":is_done})
659659
return []
660660
```
661661

0 commit comments

Comments
 (0)