Skip to content

Commit

Permalink
linted
Browse files Browse the repository at this point in the history
  • Loading branch information
josephmancuso committed Oct 27, 2024
1 parent 94b1347 commit fd6785f
Showing 1 changed file with 22 additions and 13 deletions.
35 changes: 22 additions & 13 deletions src/masoniteorm/connections/MySQLConnection.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,11 @@ def __init__(
self.password = password
self.prefix = prefix
self.full_details = full_details or {}
self.connection_pool_size = full_details.get("connection_pooling_max_size", 100)
self.connection_pool_size = (
full_details.get(
"connection_pooling_max_size", 100
)
)
self.options = options or {}
self._cursor = None
self.open = 0
Expand All @@ -50,13 +54,6 @@ def make_connection(self):
if self._dry:
return

try:
import pymysql
except ModuleNotFoundError:
raise DriverNotFound(
"You must have the 'pymysql' package installed to make a connection to MySQL. Please install it using 'pip install pymysql'"
)

if self.has_global_connection():
return self.get_global_connection()

Expand All @@ -80,7 +77,15 @@ def close_connection(self):
self._connection = None

def create_connection(self, autocommit=True):
import pymysql

try:
import pymysql
except ModuleNotFoundError:
raise DriverNotFound(
"You must have the 'pymysql' package "
"installed to make a connection to MySQL. "
"Please install it using 'pip install pymysql'"
)
import pendulum
import pymysql.converters

Expand Down Expand Up @@ -180,15 +185,19 @@ def get_cursor(self):
return self._cursor

def query(self, query, bindings=(), results="*"):
"""Make the actual query that will reach the database and come back with a result.
"""Make the actual query that
will reach the database and come back with a result.
Arguments:
query {string} -- A string query. This could be a qmarked string or a regular query.
query {string} -- A string query.
This could be a qmarked string or a regular query.
bindings {tuple} -- A tuple of bindings
Keyword Arguments:
results {str|1} -- If the results is equal to an asterisks it will call 'fetchAll'
else it will return 'fetchOne' and return a single record. (default: {"*"})
results {str|1} -- If the results is equal to an
asterisks it will call 'fetchAll'
else it will return 'fetchOne' and
return a single record. (default: {"*"})
Returns:
dict|None -- Returns a dictionary of results or None
Expand Down

0 comments on commit fd6785f

Please sign in to comment.