I am trying to save time represented as string from SQLAlchemy into a Postgresql table of which column is of type time without time zone.
I have defined SQLAlchemy column as Time(timezone=False).
The input values looks like the following: '09:23:00'.
When trying to save the data i always get sqlalchemy.exc.InterfaceError: (postgresql.exceptions.ParameterError) could not pack parameter $2::TIME WITHOUT TIME ZONE for transfer.
Any hint/help would be much appreciated.
Related
I have a requirement where I have to load Informatica SESSSTARTTIME(datetime) to SQL server timestamp. When I am trying to connect datetime to timestamp I am getting error incompatible data type.
Any suggestions how this can be achieved?
Thanks
I had a similar issue in the past, where the date column was not getting loaded because of the difference in precision of date/time used by Informatica and SQL server. You can try this workaround: Change the data type in the target definition (not in SQL Server table, only in Informatica Target definition) to String, then Informatica will pass the date/time value in quotes when firing the insert query, which SQL server can convert to date/time automatically.
in the mapping try to create output port in expression as sessionstarttime (which is a inbuilt variable) and pass it to target
hope this will help to get desire output
in session there is config tab where you can change the format for date and time
MS SQL Server timestamp datatype has nothing to do with time. It's an autogenerated number and you cannot load it.
https://msdn.microsoft.com/en-us/library/ms182776(v=SQL.90).aspx
quote:
"Is a data type that exposes automatically generated, unique binary numbers within a database. timestamp is generally used as a mechanism for version-stamping table rows. The storage size is 8 bytes. The timestamp data type is just an incrementing number and does not preserve a date or a time. To record a date or time, use a datetime data type."
I am working on Hbase database and using apache Phoenix to access Hbase using normal SQL queries.
I have two columns in table which holds the current UTC timestamp in varchar and Date. after loading some data and when I query back Hbase I am getting strange results for event timestamp column which is of Date type.
Event UTC (Date) :2017-01-13 16:36:59.0
Event UTC (varchar):2017-01-13 21:36:59
above two values should be identical but for each record when querying back Event UTC ( Date) column giving me wrong result i.e exactly 5 hours behind.
I dont know from where this problem is coming .I am not saving any Timezone info and I am aware that Java Util or SQL timestamp doesnt store any time zone info, But really confused with the result set data when running a query. Please Help me in resolving this issue
Most likely it is because of the client's local time zone.
From official docs
Timestamp type:
the internal representation is based on a number of milliseconds since the epoch (which is based on a time in GMT), while java.sql.Timestamp will format timestamps based on the client's local time zone.
Need some ideas on how to convert an entire database TIMESTAMP columns from one timezone to another.
The current server is UTC, MySQL is also UTC so everything is good in that area. All time related columns are TIMESTAMPs. The problem is that when the time information was being entered, they were in EST/EDT. For example, enter start time: data is 1/1/2011 08:00:00 AM (EST/EDT). Because timezone wasn't implemented at the start, the database stored this as 08:00:00 UTC. So all the data in the database is stored like this. Once we get data that requires timezone info, this model will break.
The question is: how do you convert all these TIMESTAMP columns into the correct UTC time? The code will be changed to deal with this on the display side on a go-forward basis but what about historic data?
The simplest way seems to do a mysqldump --tz-utc of some sort and then import the data back, then release the code. However, I can't seem to find a good example of how to do this properly or if there are other ways to do this in the most efficient way possible.
Thanks!
Could you use the MySQL AddTime function to update the existing data?
UPDATE MyTable SET MyTimeColumn = ADDTIME (MyTimeColumn, -8:00:00) WHERE <the data is bad>
I am having this trouble in converting the exiting time string into a new Time object.
When I type this in console
t = Time.parse("8am")
2010-12-06 08:00:00 +0530
it gives back 08:00 as result as seen above.
But when I store this value using
business.start_time = t
business.save(:validate => false)
it stores 02:30 in MySql db.
This happens only when I store via console. When the same data comes from forms, it stores correctly as 08:00 in MySQL table. Is there any problem here. The time zone is set different from the default utc. Please help. what should i do.
I have to parse through all the records in a table and take one string attribute and convert it into its equivalent Time class value and store it in another attribute in the same table. I am writing a rake task for it. But while storing, I get 02:30 instead 08:00 (for example).
Be very careful with dates and MySQL. Datetime fields are stored as if they were strings in the db--so whatever Rails is sending in (check your log for the SQL) is what will be stored. I assume you're set to UTC in your environment.rb, so your Time object is being output in UTC as a string.
MySQL is poor (in my opinion) with respect to handling times in different zones and converting between zones.
I recommend you don't rush through your date handling. Always handle dates in your application and DB in UTC, and do any conversion to a specific timezone on a parsing (by specifying the timezone) or by formatting it in the view.
The time seems to be stored in UTC. Try setting the timezone correctly when starting your console session.
This one has bugged me for the longest time and a great question to ask the Stackoverflow users I think.
I have a rather large SSIS flow that uses a string variable to store the datetime. I would now like to dynamically read the datetime value from the database, but how would you construct the SSIS to do this?
My first obvious thought would be to simply execute a SQL task to get the datetime and store it in the variable, but got the "differs from the current variable type" error.
Is there a simple way to convert the database datetime into a String variable?
Any help from the community would be appreciated,
Sure you use a derived column and convert the data from the datbase column to one of the correct type.
Another method would be to use t-sql code as your data source and do the cast inthe t-sql code so that the field comes into the dataflow as string.
Or of course you could change the string to a date type.