صفحه اصلی انجمن ها معاملات الگوریتمی تحلیل تکنیکال با پایتون

نمایش 3 پاسخ رشته ها
  • نویسنده
    نوشته‌ها
    • #10210
      Admin bar avatarحمید برکند
      مدیرکل

      سوالات خود در مورد این دوره را اینجا مطرح کنید

    • #10633
      وکیلی
      مشارکت کننده

      با سلام و احترام
      این خط خطا می دهد. خواهشمند است راهنمایی فرمایید. با تشکر: وکیلی

      lst = engine.execute(“””select d.GregorianDate, h.DateCode, h.Price from [ATS_ODS].[dbo].[Date] d left join ATS_ODS.dbo.[History] h on d.DateCode= h.DateCode where d.IsPersianWorkDay = 1 and d.PersianYearInt > 1397 and h.SymbolCode = 1215 order by d.GregorianDateInt asc”””).fetchall()

    • #10634
      وکیلی
      مشارکت کننده

      با سلام
      خطای این خط
      lst = engine.execute(“””select d.GregorianDate, h.DateCode, h.Price from [ATS_ODS].[dbo].[Date] d.left join ATS_ODS.dbo.[History] h on d.DateCode= h.DateCode where d.IsPersianWorkDay = 1 and d.PersianYearInt > 1397 and h.SymbolCode = 1215 order by d.GregorianDateInt asc”””).fetchall()

      —————————————————————————
      OperationalError Traceback (most recent call last)
      C:\ProgramData\Anaconda3\lib\site-packages\sqlalchemy\engine\base.py in _wrap_pool_connect(self, fn, connection)
      2335 try:
      -> 2336 return fn()
      2337 except dialect.dbapi.Error as e:

      C:\ProgramData\Anaconda3\lib\site-packages\sqlalchemy\pool\base.py in connect(self)
      363 if not self._use_threadlocal:
      –> 364 return _ConnectionFairy._checkout(self)
      365

      C:\ProgramData\Anaconda3\lib\site-packages\sqlalchemy\pool\base.py in _checkout(cls, pool, threadconns, fairy)
      777 if not fairy:
      –> 778 fairy = _ConnectionRecord.checkout(pool)
      779

      C:\ProgramData\Anaconda3\lib\site-packages\sqlalchemy\pool\base.py in checkout(cls, pool)
      494 def checkout(cls, pool):
      –> 495 rec = pool._do_get()
      496 try:

      C:\ProgramData\Anaconda3\lib\site-packages\sqlalchemy\pool\impl.py in _do_get(self)
      139 with util.safe_reraise():
      –> 140 self._dec_overflow()
      141 else:

      C:\ProgramData\Anaconda3\lib\site-packages\sqlalchemy\util\langhelpers.py in __exit__(self, type_, value, traceback)
      69 exc_value,
      —> 70 with_traceback=exc_tb,
      71 )

      C:\ProgramData\Anaconda3\lib\site-packages\sqlalchemy\util\compat.py in raise_(***failed resolving arguments***)
      181 try:
      –> 182 raise exception
      183 finally:

      C:\ProgramData\Anaconda3\lib\site-packages\sqlalchemy\pool\impl.py in _do_get(self)
      136 try:
      –> 137 return self._create_connection()
      138 except:

      C:\ProgramData\Anaconda3\lib\site-packages\sqlalchemy\pool\base.py in _create_connection(self)
      308
      –> 309 return _ConnectionRecord(self)
      310

      C:\ProgramData\Anaconda3\lib\site-packages\sqlalchemy\pool\base.py in __init__(self, pool, connect)
      439 if connect:
      –> 440 self.__connect(first_connect_check=True)
      441 self.finalize_callback = deque()

      C:\ProgramData\Anaconda3\lib\site-packages\sqlalchemy\pool\base.py in __connect(self, first_connect_check)
      660 with util.safe_reraise():
      –> 661 pool.logger.debug(“Error on connect(): %s”, e)
      662 else:

      C:\ProgramData\Anaconda3\lib\site-packages\sqlalchemy\util\langhelpers.py in __exit__(self, type_, value, traceback)
      69 exc_value,
      —> 70 with_traceback=exc_tb,
      71 )

      C:\ProgramData\Anaconda3\lib\site-packages\sqlalchemy\util\compat.py in raise_(***failed resolving arguments***)
      181 try:
      –> 182 raise exception
      183 finally:

      C:\ProgramData\Anaconda3\lib\site-packages\sqlalchemy\pool\base.py in __connect(self, first_connect_check)
      655 self.starttime = time.time()
      –> 656 connection = pool._invoke_creator(self)
      657 pool.logger.debug(“Created new connection %r”, connection)

      C:\ProgramData\Anaconda3\lib\site-packages\sqlalchemy\engine\strategies.py in connect(connection_record)
      113 return connection
      –> 114 return dialect.connect(*cargs, **cparams)
      115

      C:\ProgramData\Anaconda3\lib\site-packages\sqlalchemy\engine\default.py in connect(self, *cargs, **cparams)
      492 # inherits the docstring from interfaces.Dialect.connect
      –> 493 return self.dbapi.connect(*cargs, **cparams)
      494

      OperationalError: (‘08001’, ‘[08001] [Microsoft][SQL Server Native Client 11.0]SQL Server Network Interfaces: Error Locating Server/Instance Specified [xFFFFFFFF]. (-1) (SQLDriverConnect); [08001] [Microsoft][SQL Server Native Client 11.0]Login timeout expired (0); [08001] [Microsoft][SQL Server Native Client 11.0]A network-related or instance-specific error has occurred while establishing a connection to SQL Server. Server is not found or not accessible. Check if instance name is correct and if SQL Server is configured to allow remote connections. For more information see SQL Server Books Online. (-1)’)

      The above exception was the direct cause of the following exception:

      OperationalError Traceback (most recent call last)
      <ipython-input-3-d3494262fc16> in <module>
      —-> 1 lst = engine.execute(“””select d.GregorianDate, h.DateCode, h.Price from [ATS_ODS].[dbo].[Date] d.left join ATS_ODS.dbo.[History] h on d.DateCode= h.DateCode where d.IsPersianWorkDay = 1 and d.PersianYearInt > 1397 and h.SymbolCode = 1215 order by d.GregorianDateInt asc”””).fetchall()

      C:\ProgramData\Anaconda3\lib\site-packages\sqlalchemy\engine\base.py in execute(self, statement, *multiparams, **params)
      2232 “””
      2233
      -> 2234 connection = self._contextual_connect(close_with_result=True)
      2235 return connection.execute(statement, *multiparams, **params)
      2236

      C:\ProgramData\Anaconda3\lib\site-packages\sqlalchemy\engine\base.py in _contextual_connect(self, close_with_result, **kwargs)
      2300 return self._connection_cls(
      2301 self,
      -> 2302 self._wrap_pool_connect(self.pool.connect, None),
      2303 close_with_result=close_with_result,
      2304 **kwargs

      C:\ProgramData\Anaconda3\lib\site-packages\sqlalchemy\engine\base.py in _wrap_pool_connect(self, fn, connection)
      2338 if connection is None:
      2339 Connection._handle_dbapi_exception_noconnection(
      -> 2340 e, dialect, self
      2341 )
      2342 else:

      C:\ProgramData\Anaconda3\lib\site-packages\sqlalchemy\engine\base.py in _handle_dbapi_exception_noconnection(cls, e, dialect, engine)
      1582 elif should_wrap:
      1583 util.raise_(
      -> 1584 sqlalchemy_exception, with_traceback=exc_info[2], from_=e
      1585 )
      1586 else:

      C:\ProgramData\Anaconda3\lib\site-packages\sqlalchemy\util\compat.py in raise_(***failed resolving arguments***)
      180
      181 try:
      –> 182 raise exception
      183 finally:
      184 # credit to

      C:\ProgramData\Anaconda3\lib\site-packages\sqlalchemy\engine\base.py in _wrap_pool_connect(self, fn, connection)
      2334 dialect = self.dialect
      2335 try:
      -> 2336 return fn()
      2337 except dialect.dbapi.Error as e:
      2338 if connection is None:

      C:\ProgramData\Anaconda3\lib\site-packages\sqlalchemy\pool\base.py in connect(self)
      362 “””
      363 if not self._use_threadlocal:
      –> 364 return _ConnectionFairy._checkout(self)
      365
      366 try:

      C:\ProgramData\Anaconda3\lib\site-packages\sqlalchemy\pool\base.py in _checkout(cls, pool, threadconns, fairy)
      776 def _checkout(cls, pool, threadconns=None, fairy=None):
      777 if not fairy:
      –> 778 fairy = _ConnectionRecord.checkout(pool)
      779
      780 fairy._pool = pool

      C:\ProgramData\Anaconda3\lib\site-packages\sqlalchemy\pool\base.py in checkout(cls, pool)
      493 @classmethod
      494 def checkout(cls, pool):
      –> 495 rec = pool._do_get()
      496 try:
      497 dbapi_connection = rec.get_connection()

      C:\ProgramData\Anaconda3\lib\site-packages\sqlalchemy\pool\impl.py in _do_get(self)
      138 except:
      139 with util.safe_reraise():
      –> 140 self._dec_overflow()
      141 else:
      142 return self._do_get()

      C:\ProgramData\Anaconda3\lib\site-packages\sqlalchemy\util\langhelpers.py in __exit__(self, type_, value, traceback)
      68 compat.raise_(
      69 exc_value,
      —> 70 with_traceback=exc_tb,
      71 )
      72 else:

      C:\ProgramData\Anaconda3\lib\site-packages\sqlalchemy\util\compat.py in raise_(***failed resolving arguments***)
      180
      181 try:
      –> 182 raise exception
      183 finally:
      184 # credit to

      C:\ProgramData\Anaconda3\lib\site-packages\sqlalchemy\pool\impl.py in _do_get(self)
      135 if self._inc_overflow():
      136 try:
      –> 137 return self._create_connection()
      138 except:
      139 with util.safe_reraise():

      C:\ProgramData\Anaconda3\lib\site-packages\sqlalchemy\pool\base.py in _create_connection(self)
      307 “””Called by subclasses to create a new ConnectionRecord.”””
      308
      –> 309 return _ConnectionRecord(self)
      310
      311 def _invalidate(self, connection, exception=None, _checkin=True):

      C:\ProgramData\Anaconda3\lib\site-packages\sqlalchemy\pool\base.py in __init__(self, pool, connect)
      438 self.__pool = pool
      439 if connect:
      –> 440 self.__connect(first_connect_check=True)
      441 self.finalize_callback = deque()
      442

      C:\ProgramData\Anaconda3\lib\site-packages\sqlalchemy\pool\base.py in __connect(self, first_connect_check)
      659 except Exception as e:
      660 with util.safe_reraise():
      –> 661 pool.logger.debug(“Error on connect(): %s”, e)
      662 else:
      663 if first_connect_check:

      C:\ProgramData\Anaconda3\lib\site-packages\sqlalchemy\util\langhelpers.py in __exit__(self, type_, value, traceback)
      68 compat.raise_(
      69 exc_value,
      —> 70 with_traceback=exc_tb,
      71 )
      72 else:

      C:\ProgramData\Anaconda3\lib\site-packages\sqlalchemy\util\compat.py in raise_(***failed resolving arguments***)
      180
      181 try:
      –> 182 raise exception
      183 finally:
      184 # credit to

      C:\ProgramData\Anaconda3\lib\site-packages\sqlalchemy\pool\base.py in __connect(self, first_connect_check)
      654 try:
      655 self.starttime = time.time()
      –> 656 connection = pool._invoke_creator(self)
      657 pool.logger.debug(“Created new connection %r”, connection)
      658 self.connection = connection

      C:\ProgramData\Anaconda3\lib\site-packages\sqlalchemy\engine\strategies.py in connect(connection_record)
      112 if connection is not None:
      113 return connection
      –> 114 return dialect.connect(*cargs, **cparams)
      115
      116 creator = pop_kwarg(“creator”, connect)

      C:\ProgramData\Anaconda3\lib\site-packages\sqlalchemy\engine\default.py in connect(self, *cargs, **cparams)
      491 def connect(self, *cargs, **cparams):
      492 # inherits the docstring from interfaces.Dialect.connect
      –> 493 return self.dbapi.connect(*cargs, **cparams)
      494
      495 def create_connect_args(self, url):

      OperationalError: (pyodbc.OperationalError) (‘08001’, ‘[08001] [Microsoft][SQL Server Native Client 11.0]SQL Server Network Interfaces: Error Locating Server/Instance Specified [xFFFFFFFF]. (-1) (SQLDriverConnect); [08001] [Microsoft][SQL Server Native Client 11.0]Login timeout expired (0); [08001] [Microsoft][SQL Server Native Client 11.0]A network-related or instance-specific error has occurred while establishing a connection to SQL Server. Server is not found or not accessible. Check if instance name is correct and if SQL Server is configured to allow remote connections. For more information see SQL Server Books Online. (-1)’)
      (Background on this error at: http://sqlalche.me/e/13/e3q8)

      با تشکر: وکیلی

    • #10640
      Admin bar avatarحمید برکند
      مدیرکل

      سلام
      خطای Server is not found or not accessible به این معنی است که نام سرور اشتباه نوشته شده یا اینکه نام کاربری و پسورد اشتباه است و نمی تواند به دیتابیس وصل شود
      اگر از فایل myConfig.py برای تنظیمات استفاده میکنید، خطهای زیر را مجدد بررسی کنید:

      sql = ‘SQL+Server+Native+Client+11.0’ #sql19
      server = ‘vaio\SQL19’
      db = ‘ATS_Stage’
      user = ‘sa’
      pasw = ‘1’
      نام سرور SQL و پسورد Sa خود را مجدد چک کنید که به درستی تغییر داده باشید

      اگر از فایل myConfig.py استفاده نکرده اید این خط که مربوط به اتصال است را مجدد بررسی کنید:
      engine = sqlalchemy.create_engine(‘mssql+pyodbc://%s:%s@%s/%s?driver=%s?charset=utf8’ %(c.user,c.pasw,c.server,c.db,c.sql))

      به جای این بخش c.user,c.pasw,c.server,c.db,c.sql چک کنید که مقادیر به درستی وارد شده باشد.

      اگر بررسی کردید و اطلاعات بصورت درست وارد شده بود، بررسی کنید که آیا با این مقادیر می توانید مستقیما به SQL Management وصل شوید یا خیر

نمایش 3 پاسخ رشته ها
  • شما برای پاسخ به این موضوع باید وارد شوید.