国产成人精品久久免费动漫-国产成人精品天堂-国产成人精品区在线观看-国产成人精品日本-a级毛片无码免费真人-a级毛片毛片免费观看久潮喷

您的位置:首頁技術文章
文章詳情頁

解決django migrate報錯ORA-02000: missing ALWAYS keyword

瀏覽:91日期:2022-07-05 18:30:55

錯誤信息

解決django migrate報錯ORA-02000: missing ALWAYS keyword

PS D:parttimepythondjangoguanxiangzhiji> python manage.py migrateOperations to perform: Apply all migrations: admin, auth, contenttypes, sessionsRunning migrations:Traceback (most recent call last): File 'D:appanacondalibsite-packagesdjangodbbackendsutils.py', line 82, in _execute return self.cursor.execute(sql) File 'D:appanacondalibsite-packagesdjangodbbackendsoraclebase.py', line 510, in execute return self.cursor.execute(query, self._param_generator(params))cx_Oracle.DatabaseError: ORA-02000: missing ALWAYS keywordThe above exception was the direct cause of the following exception:Traceback (most recent call last): File 'D:appanacondalibsite-packagesdjangodbmigrationsrecorder.py', line 67, in ensure_schema editor.create_model(self.Migration) File 'D:appanacondalibsite-packagesdjangodbbackendsbaseschema.py', line 307, in create_model self.execute(sql, params or None) File 'D:appanacondalibsite-packagesdjangodbbackendsbaseschema.py', line 137, in execute cursor.execute(sql, params) File 'D:appanacondalibsite-packagesdjangodbbackendsutils.py', line 99, in execute return super().execute(sql, params) File 'D:appanacondalibsite-packagesdjangodbbackendsutils.py', line 67, in execute return self._execute_with_wrappers(sql, params, many=False, executor=self._execute) File 'D:appanacondalibsite-packagesdjangodbbackendsutils.py', line 76, in _execute_with_wrappers return executor(sql, params, many, context) File 'D:appanacondalibsite-packagesdjangodbbackendsutils.py', line 84, in _execute return self.cursor.execute(sql, params) File 'D:appanacondalibsite-packagesdjangodbutils.py', line 89, in __exit__ raise dj_exc_value.with_traceback(traceback) from exc_value File 'D:appanacondalibsite-packagesdjangodbbackendsutils.py', line 82, in _execute return self.cursor.execute(sql) File 'D:appanacondalibsite-packagesdjangodbbackendsoraclebase.py', line 510, in execute return self.cursor.execute(query, self._param_generator(params))django.db.utils.DatabaseError: ORA-02000: missing ALWAYS keywordDuring handling of the above exception, another exception occurred:Traceback (most recent call last): File 'manage.py', line 21, in <module> main() File 'manage.py', line 17, in main execute_from_command_line(sys.argv) File 'D:appanacondalibsite-packagesdjangocoremanagement__init__.py', line 381, in execute_from_command_line utility.execute() File 'D:appanacondalibsite-packagesdjangocoremanagement__init__.py', line 375, in execute self.fetch_command(subcommand).run_from_argv(self.argv) File 'D:appanacondalibsite-packagesdjangocoremanagementbase.py', line 323, in run_from_argv self.execute(*args, **cmd_options) File 'D:appanacondalibsite-packagesdjangocoremanagementbase.py', line 364, in execute output = self.handle(*args, **options) File 'D:appanacondalibsite-packagesdjangocoremanagementbase.py', line 83, in wrapped res = handle_func(*args, **kwargs) File 'D:appanacondalibsite-packagesdjangocoremanagementcommandsmigrate.py', line 234, in handle fake_initial=fake_initial, File 'D:appanacondalibsite-packagesdjangodbmigrationsexecutor.py', line 91, in migrate self.recorder.ensure_schema() File 'D:appanacondalibsite-packagesdjangodbmigrationsrecorder.py', line 69, in ensure_schema raise MigrationSchemaMissing('Unable to create the django_migrations table (%s)' % exc)django.db.migrations.exceptions.MigrationSchemaMissing: Unable to create the django_migrations table (ORA-02000: missing ALWAYS keyword)

環境情況

1、操作系統:Win10 64bit

解決django migrate報錯ORA-02000: missing ALWAYS keyword

2、Python版本:3.7.3

解決django migrate報錯ORA-02000: missing ALWAYS keyword

3、django版本:2.2.4

解決django migrate報錯ORA-02000: missing ALWAYS keyword

4、Oracle版本:11.2.0.4

解決django migrate報錯ORA-02000: missing ALWAYS keyword

5、cx_oracle版本:7.0.0

解決django migrate報錯ORA-02000: missing ALWAYS keyword

6、settings配置

解決django migrate報錯ORA-02000: missing ALWAYS keyword

原因分析

從錯誤提示ORA-02000: missing ALWAYS keyword看,是SQL語法錯誤,創建表的時候使用了Always這個關鍵詞。 Always是在Oracle12c的新特性自增序列里用到的,語法如下:

generated-column-spec[ GENERATED { ALWAYS | BY DEFAULT } AS IDENTITY [ ( START WITH IntegerConstant [ ,INCREMENT BY IntegerConstant] ) ] ] ]

但是,我機器上用的是Oracle11.2.0.4版本,這個語法在11g版本里執行自然就會報ORA-02000的錯誤。

解決方案

看了網上的一些解決方案,主要有2種:

(1)將Oracle升級到12c

(2)將cx_oracle降低版本

剛開始選用方案(2),覺得簡單,但是實際操作下來,問題一環套一環,比如說將cx_oracle降低版本后,接著出現了django版本與cx_oracle版本不適應的情況,接著又降低django版本。。。接著做還是不行,最終放棄了。不知道有沒有人成功過。

重新選擇方案(1),裝了Oracle12.1.0.2

解決django migrate報錯ORA-02000: missing ALWAYS keyword

再將django和cx_oracle升級回最新版本,migrate的時候就成功了

解決django migrate報錯ORA-02000: missing ALWAYS keyword

以上這篇解決django migrate報錯ORA-02000: missing ALWAYS keyword就是小編分享給大家的全部內容了,希望能給大家一個參考,也希望大家多多支持好吧啦網。

標簽: word
相關文章:
主站蜘蛛池模板: 午夜爽爽爽 | 国产91九色刺激露脸对白 | 一级毛片在线播放免费 | 天堂成人av | 国产一级毛片大陆 | 国产美女无遮挡软件 | 精品国产一二三区在线影院 | 国产成人精品综合在线 | 在线毛片一区二区不卡视频 | 美女视频黄a视频免费全过程 | 精品高清国产a毛片 | 日鲁夜鲁鲁狠狠综合视频 | 成人免费网站久久久 | 日韩在线一区二区三区免费视频 | 黄色一级片网址 | 久久久香蕉 | 国产黄a三级三级看三级 | 亚洲欧美日韩国产 | 欧美性色欧美a在线播放 | 成人精品国产 | 久久精品免费播放 | 一区二区精品在线观看 | 欧美精品久久久久久久久大尺度 | 亚洲免费高清 | 全免费a级毛片免费看 | 美女又黄又免费的视频 | 欧美成人综合在线 | 日韩一级黄色 | 国产精品特黄一级国产大片 | 99久久99热久久精品免费看 | 久久夜色邦福利网 | 美女张开腿让人捅 | 欧美另类视频在线观看 | 麻豆国产96在线 | 日韩 | 看片亚洲| 正在播放国产一区 | 美女张开腿让我 | 国产成人18黄网站免费网站 | 欧美精品综合一区二区三区 | 成年人免费视频观看 | 成人午夜毛片在线看 |