mkleehammer / pyodbc

Python ODBC bridge
https://github.com/mkleehammer/pyodbc/wiki
MIT No Attribution
2.95k stars 563 forks source link

sql where condition error #1216

Closed huashiyiqike closed 1 year ago

huashiyiqike commented 1 year ago

Please first make sure you have looked at:

Environment

To diagnose, we usually need to know the following, including version numbers. On Windows, be sure to specify 32-bit Python or 64-bit:

Issue

select query issues

this is good

select Name from project where id > 12949

these two are bad

select Name from project where id > 12949 AND COALESCE(aisummary, '')='' select Name from project where id > 12949 AND (aisummary='' OR aisummary is NULL)

Following is the error messages:


Traceback (most recent call last):
  File "/home/lqwsl/miniconda3/envs/textgen/lib/python3.10/threading.py", line 1016, in _bootstrap_inner
    self.run()
  File "/home/lqwsl/miniconda3/envs/textgen/lib/python3.10/threading.py", line 953, in run
    self._target(*self._args, **self._kwargs)
  File "/home/lqwsl/python/api/summary.py", line 20, in load_model
    LLM.load_model()
  File "/home/lqwsl/python/api/LLM.py", line 32, in load_model
    model = AutoModel.from_pretrained(
  File "/home/lqwsl/miniconda3/envs/textgen/lib/python3.10/site-packages/transformers/models/auto/auto_factory.py", line 455, in from_pretrained
    model_class = get_class_from_dynamic_module(
  File "/home/lqwsl/miniconda3/envs/textgen/lib/python3.10/site-packages/transformers/dynamic_module_utils.py", line 374, in get_class_from_dynamic_module
    return get_class_in_module(class_name, final_module.replace(".py", ""))
  File "/home/lqwsl/miniconda3/envs/textgen/lib/python3.10/site-packages/transformers/dynamic_module_utils.py", line 147, in get_class_in_module
    module = importlib.import_module(module_path)
  File "/home/lqwsl/miniconda3/envs/textgen/lib/python3.10/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 883, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "/home/lqwsl/.cache/huggingface/modules/transformers_modules/local/modeling_chatglm.py", line 28, in <module>
    from transformers.modeling_utils import PreTrainedModel
  File "/home/lqwsl/miniconda3/envs/textgen/lib/python3.10/site-packages/transformers/modeling_utils.py", line 83, in <module>
    from accelerate import __version__ as accelerate_version
  File "/home/lqwsl/miniconda3/envs/textgen/lib/python3.10/site-packages/accelerate/__init__.py", line 3, in <module>
    from .accelerator import Accelerator
  File "/home/lqwsl/miniconda3/envs/textgen/lib/python3.10/site-packages/accelerate/accelerator.py", line 36, in <module>
    from .tracking import LOGGER_TYPE_TO_CLASS, GeneralTracker, filter_trackers
  File "/home/lqwsl/miniconda3/envs/textgen/lib/python3.10/site-packages/accelerate/tracking.py", line 42, in <module>
    from torch.utils import tensorboard
  File "/home/lqwsl/miniconda3/envs/textgen/lib/python3.10/site-packages/torch/utils/tensorboard/__init__.py", line 12, in <module>
    from .writer import FileWriter, SummaryWriter  # noqa: F401
  File "/home/lqwsl/miniconda3/envs/textgen/lib/python3.10/site-packages/torch/utils/tensorboard/writer.py", line 13, in <module>
    from tensorboard.summary.writer.event_file_writer import EventFileWriter
  File "/home/lqwsl/miniconda3/envs/textgen/lib/python3.10/site-packages/tensorboard/summary/__init__.py", line 22, in <module>
    from tensorboard.summary import v1  # noqa: F401
  File "/home/lqwsl/miniconda3/envs/textgen/lib/python3.10/site-packages/tensorboard/summary/v1.py", line 23, in <module>
    from tensorboard.plugins.histogram import summary as _histogram_summary
  File "/home/lqwsl/miniconda3/envs/textgen/lib/python3.10/site-packages/tensorboard/plugins/histogram/summary.py", line 35, in <module>
    from tensorboard.plugins.histogram import summary_v2
  File "/home/lqwsl/miniconda3/envs/textgen/lib/python3.10/site-packages/tensorboard/plugins/histogram/summary_v2.py", line 35, in <module>
    from tensorboard.util import tensor_util
  File "/home/lqwsl/miniconda3/envs/textgen/lib/python3.10/site-packages/tensorboard/util/tensor_util.py", line 20, in <module>
    from tensorboard.compat.tensorflow_stub import dtypes, compat, tensor_shape
  File "/home/lqwsl/miniconda3/envs/textgen/lib/python3.10/site-packages/tensorboard/compat/tensorflow_stub/__init__.py", line 22, in <module>
    from .dtypes import as_dtype  # noqa
  File "/home/lqwsl/miniconda3/envs/textgen/lib/python3.10/site-packages/tensorboard/compat/tensorflow_stub/dtypes.py", line 19, in <module>
    from . import pywrap_tensorflow
  File "/home/lqwsl/miniconda3/envs/textgen/lib/python3.10/site-packages/tensorboard/compat/tensorflow_stub/pywrap_tensorflow.py", line 22, in <module>
    from .io import gfile
  File "/home/lqwsl/miniconda3/envs/textgen/lib/python3.10/site-packages/tensorboard/compat/tensorflow_stub/io/__init__.py", line 17, in <module>
    from . import gfile  # noqa
  File "/home/lqwsl/miniconda3/envs/textgen/lib/python3.10/site-packages/tensorboard/compat/tensorflow_stub/io/gfile.py", line 40, in <module>
    import fsspec
  File "/home/lqwsl/miniconda3/envs/textgen/lib/python3.10/site-packages/fsspec/__init__.py", line 3, in <module>
    from . import _version, caching
  File "/home/lqwsl/miniconda3/envs/textgen/lib/python3.10/site-packages/fsspec/caching.py", line 9, in <module>
    from concurrent.futures import ThreadPoolExecutor
  File "<frozen importlib._bootstrap>", line 1075, in _handle_fromlist
  File "/home/lqwsl/miniconda3/envs/textgen/lib/python3.10/concurrent/futures/__init__.py", line 49, in __getattr__
    from .thread import ThreadPoolExecutor as te
  File "/home/lqwsl/miniconda3/envs/textgen/lib/python3.10/concurrent/futures/thread.py", line 37, in <module>
    threading._register_atexit(_python_exit)
  File "/home/lqwsl/miniconda3/envs/textgen/lib/python3.10/threading.py", line 1504, in _register_atexit
    raise RuntimeError("can't register atexit after shutdown")
RuntimeError: can't register atexit after shutdown

trace file trace.txt

huashiyiqike commented 1 year ago

seems to be relevant only to threading

v-chojas commented 1 year ago

Yes. Next time check whether pyodbc even appears in the callstack before asking here.