當前位置: 首頁>>代碼示例>>Python>>正文


Python err.Error方法代碼示例

本文整理匯總了Python中pymysql.err.Error方法的典型用法代碼示例。如果您正苦於以下問題:Python err.Error方法的具體用法?Python err.Error怎麽用?Python err.Error使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在pymysql.err的用法示例。


在下文中一共展示了err.Error方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: setup_class

# 需要導入模塊: from pymysql import err [as 別名]
# 或者: from pymysql.err import Error [as 別名]
def setup_class(cls):
        pymysql = pytest.importorskip('pymysql')
        pymysql.connect(host='localhost', user='root', passwd='',
                        db='pandas_nosetest')
        try:
            pymysql.connect(read_default_group='pandas')
        except pymysql.ProgrammingError:
            raise RuntimeError(
                "Create a group of connection parameters under the heading "
                "[pandas] in your system's mysql default file, "
                "typically located at ~/.my.cnf or /etc/.my.cnf.")
        except pymysql.Error:
            raise RuntimeError(
                "Cannot connect to database. "
                "Create a group of connection parameters under the heading "
                "[pandas] in your system's mysql default file, "
                "typically located at ~/.my.cnf or /etc/.my.cnf.") 
開發者ID:awslabs,項目名稱:predictive-maintenance-using-machine-learning,代碼行數:19,代碼來源:test_sql.py

示例2: setup_method

# 需要導入模塊: from pymysql import err [as 別名]
# 或者: from pymysql.err import Error [as 別名]
def setup_method(self, request, datapath):
        pymysql = pytest.importorskip('pymysql')
        pymysql.connect(host='localhost', user='root', passwd='',
                        db='pandas_nosetest')
        try:
            pymysql.connect(read_default_group='pandas')
        except pymysql.ProgrammingError:
            raise RuntimeError(
                "Create a group of connection parameters under the heading "
                "[pandas] in your system's mysql default file, "
                "typically located at ~/.my.cnf or /etc/.my.cnf.")
        except pymysql.Error:
            raise RuntimeError(
                "Cannot connect to database. "
                "Create a group of connection parameters under the heading "
                "[pandas] in your system's mysql default file, "
                "typically located at ~/.my.cnf or /etc/.my.cnf.")

        self.method = request.function 
開發者ID:awslabs,項目名稱:predictive-maintenance-using-machine-learning,代碼行數:21,代碼來源:test_sql.py

示例3: _close_conn

# 需要導入模塊: from pymysql import err [as 別名]
# 或者: from pymysql.err import Error [as 別名]
def _close_conn(self):
        from pymysql.err import Error
        try:
            self.conn.close()
        except Error:
            pass 
開發者ID:Frank-qlu,項目名稱:recruit,代碼行數:8,代碼來源:test_sql.py

示例4: test_read_procedure

# 需要導入模塊: from pymysql import err [as 別名]
# 或者: from pymysql.err import Error [as 別名]
def test_read_procedure(self):
        import pymysql
        # see GH7324. Although it is more an api test, it is added to the
        # mysql tests as sqlite does not have stored procedures
        df = DataFrame({'a': [1, 2, 3], 'b': [0.1, 0.2, 0.3]})
        df.to_sql('test_procedure', self.conn, index=False)

        proc = """DROP PROCEDURE IF EXISTS get_testdb;

        CREATE PROCEDURE get_testdb ()

        BEGIN
            SELECT * FROM test_procedure;
        END"""

        connection = self.conn.connect()
        trans = connection.begin()
        try:
            r1 = connection.execute(proc)  # noqa
            trans.commit()
        except pymysql.Error:
            trans.rollback()
            raise

        res1 = sql.read_sql_query("CALL get_testdb();", self.conn)
        tm.assert_frame_equal(df, res1)

        # test delegation to read_sql_query
        res2 = sql.read_sql("CALL get_testdb();", self.conn)
        tm.assert_frame_equal(df, res2) 
開發者ID:Frank-qlu,項目名稱:recruit,代碼行數:32,代碼來源:test_sql.py

示例5: setup_class

# 需要導入模塊: from pymysql import err [as 別名]
# 或者: from pymysql.err import Error [as 別名]
def setup_class(cls):
        _skip_if_no_pymysql()

        # test connection
        import pymysql
        try:
            # Try Travis defaults.
            # No real user should allow root access with a blank password.
            pymysql.connect(host='localhost', user='root', passwd='',
                            db='pandas_nosetest')
        except:
            pass
        else:
            return
        try:
            pymysql.connect(read_default_group='pandas')
        except pymysql.ProgrammingError:
            pytest.skip(
                "Create a group of connection parameters under the heading "
                "[pandas] in your system's mysql default file, "
                "typically located at ~/.my.cnf or /etc/.my.cnf. ")
        except pymysql.Error:
            pytest.skip(
                "Cannot connect to database. "
                "Create a group of connection parameters under the heading "
                "[pandas] in your system's mysql default file, "
                "typically located at ~/.my.cnf or /etc/.my.cnf. ") 
開發者ID:birforce,項目名稱:vnpy_crypto,代碼行數:29,代碼來源:test_sql.py

示例6: setup_method

# 需要導入模塊: from pymysql import err [as 別名]
# 或者: from pymysql.err import Error [as 別名]
def setup_method(self, request, datapath):
        _skip_if_no_pymysql()
        import pymysql
        try:
            # Try Travis defaults.
            # No real user should allow root access with a blank password.
            self.conn = pymysql.connect(host='localhost', user='root',
                                        passwd='', db='pandas_nosetest')
        except:
            pass
        else:
            return
        try:
            self.conn = pymysql.connect(read_default_group='pandas')
        except pymysql.ProgrammingError:
            pytest.skip(
                "Create a group of connection parameters under the heading "
                "[pandas] in your system's mysql default file, "
                "typically located at ~/.my.cnf or /etc/.my.cnf. ")
        except pymysql.Error:
            pytest.skip(
                "Cannot connect to database. "
                "Create a group of connection parameters under the heading "
                "[pandas] in your system's mysql default file, "
                "typically located at ~/.my.cnf or /etc/.my.cnf. ")

        self.method = request.function 
開發者ID:birforce,項目名稱:vnpy_crypto,代碼行數:29,代碼來源:test_sql.py

示例7: setup_method

# 需要導入模塊: from pymysql import err [as 別名]
# 或者: from pymysql.err import Error [as 別名]
def setup_method(self, method):
        _skip_if_no_pymysql()
        import pymysql
        try:
            # Try Travis defaults.
            # No real user should allow root access with a blank password.
            self.conn = pymysql.connect(host='localhost', user='root',
                                        passwd='', db='pandas_nosetest')
        except:
            pass
        else:
            return
        try:
            self.conn = pymysql.connect(read_default_group='pandas')
        except pymysql.ProgrammingError:
            pytest.skip(
                "Create a group of connection parameters under the heading "
                "[pandas] in your system's mysql default file, "
                "typically located at ~/.my.cnf or /etc/.my.cnf. ")
        except pymysql.Error:
            pytest.skip(
                "Cannot connect to database. "
                "Create a group of connection parameters under the heading "
                "[pandas] in your system's mysql default file, "
                "typically located at ~/.my.cnf or /etc/.my.cnf. ")

        self.method = method 
開發者ID:securityclippy,項目名稱:elasticintel,代碼行數:29,代碼來源:test_sql.py


注:本文中的pymysql.err.Error方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。