通过sqlalchemy将日期字段保存到oracle
我这样定义我的映射器:通过sqlalchemy将日期字段保存到oracle,sqlalchemy,Sqlalchemy,我这样定义我的映射器: col = Column(Date). 当我将数据保存到oracle时,我使用datetime.datetime.now()作为col的值,它会提高 NotSupportedError: (NotSupportedError) Variable_TypeByValue(): unhandled data type time.struct_time 我只需要将日期信息存储到此字段中,但我不知道如何执行此操作。我也是 对如何将datetime存储到字段感到好奇 evn:P
col = Column(Date).
当我将数据保存到oracle时,我使用datetime.datetime.now()作为col的值,它会提高
NotSupportedError: (NotSupportedError) Variable_TypeByValue(): unhandled data
type time.struct_time
我只需要将日期信息存储到此字段中,但我不知道如何执行此操作。我也是
对如何将datetime存储到字段感到好奇
evn:Python2.7.3、sqlalchemy0.8.0b2、cx_Oracle 5.1.2对于不同的数据类型,我也面临同样的问题,找到这个解决方案也可能会对您有所帮助 例如: Apache配置
<VirtualHost *:80>
ServerName testenv-test.my.fq.dn
ServerAlias testenv-test
WSGIDaemonProcess testenv user=michel threads=5
WSGIScriptAlias / /var/www/michel/testenv/wsgi/app.wsgi
SetEnv MYAPP_PATH /var/www/michel/testenv/config
<Directory /var/www/michel/testenv/wsgi>
WSGIProcessGroup testenv
WSGIApplicationGroup %{GLOBAL}
Order deny,allow
Allow from all
</Directory>
ErrorLog /var/www/michel/testenv/logs/error.log
LogLevel warn
CustomLog /var/www/michel/testenv/logs/access.log combined
</VirtualHost>
ServerName testenv-test.my.fq.dn
服务器别名测试NV测试
wsgidaemonprocesstestenv user=michel threads=5
WSGIScriptAlias//var/www/michel/testenv/wsgi/app.wsgi
SetEnv MYAPP_PATH/var/www/michel/testenv/config
WSGIProcessGroup测试程序
WSGIApplicationGroup%{GLOBAL}
命令拒绝,允许
通融
ErrorLog/var/www/michel/testenv/logs/error.log
日志级别警告
CustomLog/var/www/michel/testenv/logs/access.log
datetime.date.today()
的类型听起来更像是调用time.localtime()
函数,该函数返回一个struct\u time
datetime.now()
返回一个datetime.datetime
。我是python和sqlalchemy的新手,不知道使用哪个对象或函数