欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

解決django migrate報(bào)錯(cuò)ORA-02000: missing ALWAYS keyword

 更新時(shí)間:2020年07月02日 14:27:54   作者:觀想  
這篇文章主要介紹了解決django migrate報(bào)錯(cuò)ORA-02000: missing ALWAYS keyword,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。一起跟隨小編過(guò)來(lái)看看吧

錯(cuò)誤信息

PS D:\parttime\python\django\guanxiangzhiji> python manage.py migrate
Operations to perform:
 Apply all migrations: admin, auth, contenttypes, sessions
Running migrations:
Traceback (most recent call last):
 File "D:\app\anaconda\lib\site-packages\django\db\backends\utils.py", line 82, in _execute
 return self.cursor.execute(sql)
 File "D:\app\anaconda\lib\site-packages\django\db\backends\oracle\base.py", line 510, in execute
 return self.cursor.execute(query, self._param_generator(params))
cx_Oracle.DatabaseError: ORA-02000: missing ALWAYS keyword

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

Traceback (most recent call last):
 File "D:\app\anaconda\lib\site-packages\django\db\migrations\recorder.py", line 67, in ensure_schema
 editor.create_model(self.Migration)
 File "D:\app\anaconda\lib\site-packages\django\db\backends\base\schema.py", line 307, in create_model
 self.execute(sql, params or None)
 File "D:\app\anaconda\lib\site-packages\django\db\backends\base\schema.py", line 137, in execute
 cursor.execute(sql, params)
 File "D:\app\anaconda\lib\site-packages\django\db\backends\utils.py", line 99, in execute
 return super().execute(sql, params)
 File "D:\app\anaconda\lib\site-packages\django\db\backends\utils.py", line 67, in execute
 return self._execute_with_wrappers(sql, params, many=False, executor=self._execute)
 File "D:\app\anaconda\lib\site-packages\django\db\backends\utils.py", line 76, in _execute_with_wrappers
 return executor(sql, params, many, context)
 File "D:\app\anaconda\lib\site-packages\django\db\backends\utils.py", line 84, in _execute
 return self.cursor.execute(sql, params)
 File "D:\app\anaconda\lib\site-packages\django\db\utils.py", line 89, in __exit__
 raise dj_exc_value.with_traceback(traceback) from exc_value
 File "D:\app\anaconda\lib\site-packages\django\db\backends\utils.py", line 82, in _execute
 return self.cursor.execute(sql)
 File "D:\app\anaconda\lib\site-packages\django\db\backends\oracle\base.py", line 510, in execute
 return self.cursor.execute(query, self._param_generator(params))
django.db.utils.DatabaseError: ORA-02000: missing ALWAYS keyword

During 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:\app\anaconda\lib\site-packages\django\core\management\__init__.py", line 381, in execute_from_command_line
 utility.execute()
 File "D:\app\anaconda\lib\site-packages\django\core\management\__init__.py", line 375, in execute
 self.fetch_command(subcommand).run_from_argv(self.argv)
 File "D:\app\anaconda\lib\site-packages\django\core\management\base.py", line 323, in run_from_argv
 self.execute(*args, **cmd_options)
 File "D:\app\anaconda\lib\site-packages\django\core\management\base.py", line 364, in execute
 output = self.handle(*args, **options)
 File "D:\app\anaconda\lib\site-packages\django\core\management\base.py", line 83, in wrapped
 res = handle_func(*args, **kwargs)
 File "D:\app\anaconda\lib\site-packages\django\core\management\commands\migrate.py", line 234, in handle
 fake_initial=fake_initial,
 File "D:\app\anaconda\lib\site-packages\django\db\migrations\executor.py", line 91, in migrate
 self.recorder.ensure_schema()
 File "D:\app\anaconda\lib\site-packages\django\db\migrations\recorder.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)

環(huán)境情況

1、操作系統(tǒng):Win10 64bit

2、Python版本:3.7.3

3、django版本:2.2.4

4、Oracle版本:11.2.0.4

5、cx_oracle版本:7.0.0

6、settings配置

原因分析

從錯(cuò)誤提示ORA-02000: missing ALWAYS keyword看,是SQL語(yǔ)法錯(cuò)誤,創(chuàng)建表的時(shí)候使用了Always這個(gè)關(guān)鍵詞。 Always是在Oracle12c的新特性自增序列里用到的,語(yǔ)法如下:

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

但是,我機(jī)器上用的是Oracle11.2.0.4版本,這個(gè)語(yǔ)法在11g版本里執(zhí)行自然就會(huì)報(bào)ORA-02000的錯(cuò)誤。

解決方案

看了網(wǎng)上的一些解決方案,主要有2種:

(1)將Oracle升級(jí)到12c

(2)將cx_oracle降低版本

剛開(kāi)始選用方案(2),覺(jué)得簡(jiǎn)單,但是實(shí)際操作下來(lái),問(wèn)題一環(huán)套一環(huán),比如說(shuō)將cx_oracle降低版本后,接著出現(xiàn)了django版本與cx_oracle版本不適應(yīng)的情況,接著又降低django版本。。。接著做還是不行,最終放棄了。不知道有沒(méi)有人成功過(guò)。

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

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

以上這篇解決django migrate報(bào)錯(cuò)ORA-02000: missing ALWAYS keyword就是小編分享給大家的全部?jī)?nèi)容了,希望能給大家一個(gè)參考,也希望大家多多支持腳本之家。

相關(guān)文章

  • python如何實(shí)現(xiàn)內(nèi)容寫(xiě)在圖片上

    python如何實(shí)現(xiàn)內(nèi)容寫(xiě)在圖片上

    這篇文章主要為大家詳細(xì)介紹了python如何實(shí)現(xiàn)內(nèi)容寫(xiě)在圖片上,具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下
    2018-03-03
  • Python lxml庫(kù)的簡(jiǎn)單介紹及基本使用講解

    Python lxml庫(kù)的簡(jiǎn)單介紹及基本使用講解

    lxml是XML和HTML的解析器,其主要功能是解析和提取XML和HTML中的數(shù)據(jù),本文重點(diǎn)給大家介紹Python lxml庫(kù)的簡(jiǎn)單介紹及基本使用講解,感興趣的朋友跟隨小編一起看看吧
    2020-12-12
  • python db類(lèi)用法說(shuō)明

    python db類(lèi)用法說(shuō)明

    這篇文章主要介紹了python db類(lèi)用法說(shuō)明,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。一起跟隨小編過(guò)來(lái)看看吧
    2020-07-07
  • Python數(shù)據(jù)處理Pandas庫(kù)的使用詳解

    Python數(shù)據(jù)處理Pandas庫(kù)的使用詳解

    這篇文章主要為大家詳細(xì)介紹了pandas庫(kù)的使用方法,包括數(shù)據(jù)導(dǎo)入與導(dǎo)出、數(shù)據(jù)查看和篩選、數(shù)據(jù)處理和分組操作等,感興趣的小伙伴可以了解一下
    2023-07-07
  • python實(shí)現(xiàn)讀取excel表格詳解方法

    python實(shí)現(xiàn)讀取excel表格詳解方法

    python操作excel主要用到xlrd和xlwt兩個(gè)庫(kù),xlrd讀取表格數(shù)據(jù),支持xlsx和xls格式的excel表格;xlwt寫(xiě)入excel表格數(shù)據(jù)
    2022-07-07
  • python+selenium實(shí)現(xiàn)簡(jiǎn)歷自動(dòng)刷新的示例代碼

    python+selenium實(shí)現(xiàn)簡(jiǎn)歷自動(dòng)刷新的示例代碼

    這篇文章主要介紹了python+selenium實(shí)現(xiàn)簡(jiǎn)歷自動(dòng)刷新的示例代碼,文中通過(guò)示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)學(xué)習(xí)吧
    2019-05-05
  • python代碼 FTP備份交換機(jī)配置腳本實(shí)例解析

    python代碼 FTP備份交換機(jī)配置腳本實(shí)例解析

    這篇文章主要介紹了python代碼 FTP備份交換機(jī)配置腳本實(shí)例解析,文中通過(guò)示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友可以參考下
    2019-08-08
  • python文件操作之目錄遍歷實(shí)例分析

    python文件操作之目錄遍歷實(shí)例分析

    這篇文章主要介紹了python文件操作之目錄遍歷的方法,以實(shí)例形式較為詳細(xì)的分析了目錄遍歷所需要用到的相關(guān)函數(shù)與使用技巧,需要的朋友可以參考下
    2015-05-05
  • pytorch實(shí)踐線性模型3d詳解

    pytorch實(shí)踐線性模型3d詳解

    這篇文章主要介紹了pytorch實(shí)踐線性模型3d詳解,本文給大家介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或工作具有一定的參考借鑒價(jià)值,需要的朋友可以參考下
    2023-04-04
  • 利用Python自動(dòng)化生成愛(ài)豆日歷詳解

    利用Python自動(dòng)化生成愛(ài)豆日歷詳解

    openpyxl,一個(gè)能讀取和修改Excel電子表格的Pyhton模塊,可以實(shí)現(xiàn)自動(dòng)化處理表格信息,擺脫無(wú)趣無(wú)味。本文將利用openpyxl和calendar庫(kù),實(shí)現(xiàn)自動(dòng)化生成愛(ài)豆日歷,感興趣的可以了解一下
    2022-05-05

最新評(píng)論