pymssql/freetds date from sqlserver - date

I am trying to get the date datatype from SQLserver 2014 as native python date through pymssql. Based on pymssql doc, I need to have 0.95+ freetds lib and 7.3 freetds ver.
# tsql -C
Compile-time settings (established with the "configure" script)
Version: freetds v0.95.8
freetds.conf directory: /etc
MS db-lib source compatibility: no
Sybase binary compatibility: no
Thread safety: yes
iconv library: yes
TDS version: 4.2
iODBC: no
unixodbc: yes
SSPI "trusted" logins: no
Kerberos: no
OpenSSL: no
GnuTLS: no
And I made following config:
#/etc/freetds.conf
[sqlsvr1]
host = sqlsvr1
port = 1433
tds version = 7.3
And I still get python string instead of date. This is from the TDSDUMPCONFIG. Is it because freetds 0.95.8 does not support tds 7.3? (The major/minor version seem to have been replace to 7/1).
config.c:620:IP addr is 172.16.12.26.
config.c:580: port = '1433'
config.c:580: tds version = '7.3'
config.c:886:Setting tds version to 7.3 (0x703).
config.c:568: Reached EOF
config.c:300:Success: [sqlsvr1] defined in /etc/freetds.conf.
config.c:765:Setting 'dump_file' to '/tmp/freetds.log' from $TDSDUMP.
config.c:689:tds_config_login: client_charset is UTF-8.
config.c:213:Final connection parameters:
config.c:214: server_name = sqlsvr1:1433
config.c:215: server_host_name = sqlsvr1
config.c:218: ip_addr = 172.16.12.26
config.c:218: ip_addr = 172.16.12.26
config.c:218: ip_addr = 172.16.12.26
config.c:223: instance_name =
config.c:224: port = 1433
config.c:225: major_version = 7
config.c:226: minor_version = 1
config.c:227: block_size = 0
config.c:228: language = us_english
config.c:229: server_charset =
config.c:230: connect_timeout = 0
config.c:231: client_host_name = rh1.int
config.c:232: client_charset = UTF-8
config.c:233: use_utf16 = 0
config.c:234: app_name = pymssql
config.c:235: user_name = USER
config.c:238: library = DB-Library
config.c:239: bulk_copy = 0
config.c:240: suppress_language = 0
config.c:241: encrypt level = 0
config.c:242: query_timeout = 0
config.c:245: database =
config.c:246: dump_file = /tmp/freetds.log
config.c:247: debug_flags = 0
config.c:248: text_size = 64512
config.c:249: emul_little_endian = 0
config.c:250: server_realm_name =
config.c:251: server_spn =
config.c:252: cafile =
config.c:253: crlfile =
If I set the tds version to 7.4 in the config, then I notice this error in the log:
config.c:580: tds version = '7.4'
config.c:881:error: no such version: 7.4
config.c:568: Reached EOF
config.c:213:Final connection parameters:
... ...
config.c:225: major_version = 7
config.c:226: minor_version = 1
Env: Linux/RH 6 + Python3.4.3 + pymssql(2.1.1) all x64
Any suggestions?

You have most of the required pieces.
But the one missing is the fact you are using pymssql 2.1.1.
Support for the DATE and TIME data types is implemented but targeted for pymssql 2.2.0 which isn't released yet. If you need it now you'll need to build it yourself from the 'master' Git branch first.

Related

snmpget “No such object available on this agent at this OID”

I have been working on trying to get a value with a custom MIB through SNMP following this tutorial. I'm using net-snmp 5.7.3. I have used this MIB along with the corresponding codes with this.
My setup: I have two VM's, both Ubuntu 16, one is snmp-server with IP:192.168.5.20 and the other snmp-agent with IP:192.168.5.21.
I did MIBS=ALL and export MIBS. On the agent, I have successfully compiled my MIB and got the expected output. My code files are in the path /home/snmp-agent/Desktop/proj/net-snmp-5.7.3/agent/mibgroup/. I reconfigure mthe net-snmp like this:
./configure --with-mib-modules="pingCtlTable pingResultsTable pingProbeHistoryTable"
make
make install
Everything worked fine. And when I do snmptranslate on the agent I get:
root#snmpagent:~# snmptranslate -On DISMAN-PING-MIB::pingResultsTable
.1.3.6.1.2.1.80.1.3
root#snmpagent:~# snmptranslate -On DISMAN-PING-MIB::pingCtlTable
.1.3.6.1.2.1.80.1.2
root#snmpagent:~# snmptranslate -On DISMAN-PING-MIB::pingProbeHistoryTable
.1.3.6.1.2.1.80.1.4
Output on the server, when I do this:
snmpget -v2c -c public 192.168.5.21 sysDescr.0
SNMPv2-MIB::sysDescr.0 = STRING: Linux snmp-agent 4.10.0-33-generic #37~16.04.1-Ubuntu SMP Fri Aug 11 14:07:24 UTC 2017 x86_64
But when I run snmpget, from the server, I get this error for all the three:
snmpget -v2c -c public 192.168.5.21 DISMAN-PING-MIB::pingCtlTable.0
DISMAN-PING-MIB::pingCtlTable = No Such Object available on this agent at this OID
Output when specified the OID's:
snmpget -v2c -c public 192.168.5.21 .1.3.6.1.2.1.80.1.2
DISMAN-PING-MIB::pingCtlTable = No Such Object available on this agent at this OID
NOTE: I have already seen these posts with no luck for me.
add new mib master agent
snmpget-no-such-object... and snmpget-returns-no-such-object...
UPDATE 2:
When I do snmpwalk from the server, I get:
root#snmp-server:# snmp-server:# snmpwalk -v 2c -c ncs -m DISMAN-PING-MIB 192.168.5.22 .1.3.6.1.2.1.80
DISMAN-PING-MIB::pingObjects.0 = INTEGER: 1
DISMAN-PING-MIB::pingFullCompliance.15.46.49.46.51.46.54.46.49.46.50.46.49.46.56.48 = STRING: "/bin/echo"
DISMAN-PING-MIB::pingMinimumCompliance.15.46.49.46.51.46.54.46.49.46.50.46.49.46.56.48 = ""
DISMAN-PING-MIB::pingCompliances.4.15.46.49.46.51.46.54.46.49.46.50.46.49.46.56.48 = ""
DISMAN-PING-MIB::pingCompliances.5.15.46.49.46.51.46.54.46.49.46.50.46.49.46.56.48 = INTEGER: 5
DISMAN-PING-MIB::pingCompliances.6.15.46.49.46.51.46.54.46.49.46.50.46.49.46.56.48 = INTEGER: 1
DISMAN-PING-MIB::pingCompliances.7.15.46.49.46.51.46.54.46.49.46.50.46.49.46.56.48 = INTEGER: 1
DISMAN-PING-MIB::pingCompliances.20.15.46.49.46.51.46.54.46.49.46.50.46.49.46.56.48 = INTEGER: 4
DISMAN-PING-MIB::pingCompliances.21.15.46.49.46.51.46.54.46.49.46.50.46.49.46.56.48 = INTEGER: 1
DISMAN-PING-MIB::pingIcmpEcho.1.15.46.49.46.51.46.54.46.49.46.50.46.49.46.56.48 = ""
DISMAN-PING-MIB::pingIcmpEcho.2.15.46.49.46.51.46.54.46.49.46.50.46.49.46.56.48 = ""
DISMAN-PING-MIB::pingIcmpEcho.3.15.46.49.46.51.46.54.46.49.46.50.46.49.46.56.48 = INTEGER: 1
DISMAN-PING-MIB::pingIcmpEcho.4.15.46.49.46.51.46.54.46.49.46.50.46.49.46.56.48 = INTEGER: 0
DISMAN-PING-MIB::pingMIB.4.1.2.15.46.49.46.51.46.54.46.49.46.50.46.49.46.56.48.1 = ""
So accordingly when I follow the output of snmpwalk, I get:
root#snmp-server:# snmpget 192.168.5.22 DISMAN-PING-MIB::pingFullCompliance.15.46.49.46.51.46.54.46.49.46.50.46.49.46.56.48
DISMAN-PING-MIB::pingFullCompliance.15.46.49.46.51.46.54.46.49.46.50.46.49.46.56.48 = Wrong Type (should be INTEGER): STRING: "/bin/echo"
I don't understand why I have such a long OID? What is pingFullCompliance.15.46.49.46.51.46.54.46.49.46.50.46.49.46.56.48 ? Where am I going wrong? Can anyone please point me in the right direction... Thank you.

TYPO3 version 6 to version 8 compatibility issues

While upgrading typo3 version 6 to 8.7.3 getting this database error...
An exception occurred while executing 'SELECT `pid` FROM `sys_template` WHERE (root = 1 AND deleted = 0 AND hidden = 0 AND starttime <= :starttime AND (endtime = 0 OR endtime > :endtime)) AND ((`sys_template`.`deleted` = 0) AND (`sys_template`.`hidden` = 0) AND (`sys_template`.`starttime` <= 1500543000) AND ((`sys_template`.`endtime` = 0) OR (`sys_template`.`endtime` > 1500543000)))': You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ':starttime AND (endtime = 0 OR endtime > :endtime)) AND ((`sys_template`.`delete' at line 1
Please review the screen shot.
DB Configuration variables have changed from TYPO3 v7 to v8 ^^
It is not
$GLOBALS['TYPO3_CONF_VARS']['DB']['database']
$GLOBALS['TYPO3_CONF_VARS']['DB']['host']
$GLOBALS['TYPO3_CONF_VARS']['DB']['username']
$GLOBALS['TYPO3_CONF_VARS']['DB']['password']
anymore, but
$GLOBALS['TYPO3_CONF_VARS']['DB']['Connections']['Default']['host']
$GLOBALS['TYPO3_CONF_VARS']['DB']['Connections']['Default']['dbname']
$GLOBALS['TYPO3_CONF_VARS']['DB']['Connections']['Default']['user']
$GLOBALS['TYPO3_CONF_VARS']['DB']['Connections']['Default']['password']
This is especially the case, when configuring additional Environments via AdditionalConfiguration.php

FATAL: no indexes found in config file

I am trying to run the indexer of my sphinx server.
This is the command I use (through root access) to start the indexing:
indexer --all
When I use the command, this is the reponse I get:
Sphinx 2.1.9-id64-release (rel21-r4761)
Copyright (c) 2001-2014, Andrew Aksyonoff
Copyright (c) 2008-2014, Sphinx Technologies Inc (http://sphinxsearch.com)
using config file '/etc/sphinxsearch/sphinx.conf'...
FATAL: no indexes found in config file '/etc/sphinxsearch/sphinx.conf'
This is the sphinx.conf file that is located in /etc/sphinxsearch/
#############################################################################
## indexer settings
#############################################################################
indexer
{
# memory limit, in bytes, kiloytes (16384K) or megabytes (256M)
# optional, default is 32M, max is 2047M, recommended is 256M to 1024M
mem_limit = 1024M
}
#############################################################################
## searchd settings
#############################################################################
searchd
{
listen = 127.0.0.1:9312
listen = 127.0.0.1:9306:mysql41
log = /var/log/sphinxsearch/searchd.log
query_log = /var/log/sphinxsearch/query.log
read_timeout = 5
client_timeout = 300
max_children = 30
pid_file = /var/log/sphinxsearch/searchd.pid
max_matches = 1000
seamless_rotate = 1
preopen_indexes = 1
unlink_old = 1
mva_updates_pool = 1M
max_packet_size = 8M
max_filters = 256
max_filter_values = 4096
workers = threads # for RT to work
}
index myindex
{
type = rt
path = /var/www/vhosts/user/sphinx/myindex
rt_field = description
rt_field = searchcode
rt_field = weight
rt_field = productid
rt_attr_uint = stockproduct
rt_attr_uint = instock
charset_type = utf-8
min_infix_len = 3
enable_star = 1
expand_keywords = 1
dict = keywords
}
# --eof--
Can someone help me with resolving this error?
FATAL: no indexes found in config file '/etc/sphinxsearch/sphinx.conf
the indexer command only works on traditional disk-index. Not real time indexes.
Because indexer doesn't do anything with type=rt it doesnt 'see' them, hence your config file has no indexes to index.
I guess in an ideal world it would say 'no plain indexes found' or similar to clarify its ignoring rt (same as it ignores distributed)
All you have to do is put sphinx.conf file inside bin folder, which mean it will be inside this path for example "etc/sphinxsearch/bin/sphinx.conf".

Wildcard search issue sphinx

I'm getting the following error while trying a wildcard(*) enabled search in Sphinx 2.0.6
index products: syntax error, unexpected $undefined near '*'
My search term is iphone 4s*
It's using the products index as defined below.
index users
{
enable_star = 1
docinfo = extern
morphology = stem_en
charset_table = 0..9, A..Z->a..z, _, a..z, U+410..U+42F->U+430..U+44F, U+430..U+44F
ignore_chars = U+0021..U+002F,U+003A..U+003F,U+0060
charset_type = utf-8
html_strip = 0
source = gdgt_user
path = /var/lib/sphinxsearch/data/gdgt/users
min_infix_len = 3
min_word_len = 3
}
index products : users
{
enable_star = 1
min_infix_len = 1
min_word_len = 1
source = gdgt_products
path = /var/lib/sphinxsearch/data/gdgt/products
}
I am using the php api that can be found in the source tar ball.
I am able to see the error when using search CLI.
search -c app/config/sphinx.compiled.conf -i products -e "ipho*"
Sphinx 2.0.6-id64-release (r3473)
Copyright (c) 2001-2012, Andrew Aksyonoff
Copyright (c) 2008-2012, Sphinx Technologies Inc (http://sphinxsearch.com)
using config file 'app/config/sphinx.compiled.conf'...
index 'products': search error: .
My php code looks like
$client = new SphinxClient();
$client->SetServer($serverIp, $serverPort);
$client->SetMaxQueryTime(5000);
$client->SetSortMode(SPH_SORT_RELEVANCE);
$client->SetMatchMode(SPH_MATCH_EXTENDED);
$res = $client->query('ipho*', 'products');
var_dump($res, $client->getLastError(), $client->getLastWarning());
The issue is that star(*) for wildcard is also in your ignore_chars (U+002A).
Update it to:
ignore_chars = U+0021..U+0029,U+002B..U+002F,U+003A..U+003F,U+0060

xDebug session never starts

I've just change my OS to Windows 7 64.
I have Apache 2.2, PHP 5.3 (32bit) TS and Eclipse 3.7 (64bit) with PDT installed on my machine.
xDebug section in my php.ini
zend_extension = "C:\Program Files (x86)\PHP\ext\php_xdebug-2.1.4-5.3-vc9.dll"
xdebug.auto_trace = 0
xdebug.collect_includes = 1
xdebug.collect_params = 0
xdebug.collect_return = 0
xdebug.default_enable = 1
xdebug.extended_info = 1
xdebug.idekey = "STATION24$"
xdebug.max_nesting_level = 100
xdebug.profiler_append = 0
xdebug.profiler_enable = 0
xdebug.profiler_enable_trigger = 1
xdebug.profiler_output_dir = "C:\WINDOWS\temp"
xdebug.profiler_output_name = "xdebug_profile.%p"
xdebug.remote_autostart = 0
xdebug.remote_enable = 1
xdebug.remote_handler = "dbgp"
xdebug.remote_host = "localhost"
xdebug.remote_log = 1
xdebug.remote_mode = "req"
xdebug.remote_port = 9001
xdebug.show_exception_trace = 0
xdebug.show_local_vars = 0
xdebug.show_mem_delta = 1
xdebug.trace_format = 0
xdebug.trace_output_dir = "C:\WINDOWS\Temp"
xdebug.trace_output_name = "trace.%c"
xdebug.var_display_max_depth = 5
In Eclipse I've configured PHP->Debug section as shown on images:
And now, when I try to launch debug, Eclipse freeze at starting debug session.
So, I'd read about this problem in past, people say this is because some application use xDebug port (in my case 9001), but I've checked, no other use this port, only xDebug do.
My firewall disabled, so no one application can block connection to xDebug. And one thing - "debug as CLI application" works well, only "debug as Web application" does not work.
I don't know what to do, please help.
If you run into problems and you don't know whether the Xdebug side is not working, or the IDE's side, then from Xdebug 2.2.0RC1 the remote debug log will also log connection issues.
Just a thought, you mention PHP TS. Maybe you should use xdebug TS too then?
(Although I read everywhere that lately you better not use TS at all, so might want to change php not TS or so).