emcp
09/09/2021, 7:56 PMclient.py
.. but when I go to query this in apache superset it is giving me an error.. is there some extra manipulation I should do before I pass the timestamp via the dictionary??
Client.py
creation_datetime = datetime.now(timezone.utc)
...
new_record = {
"key": valid_value.contract.symbol.lower(),
"datetime_downloaded_from_api": creation_datetime
}
yield new_record
Apache Superset query tools says
SELECT * FROM my_new_table;
PostgreSQL Error
postgresql error: '>=' not supported between instances of 'datetime.timedelta' and 'int'
Maybe this is more of a Apache Superset question.. I will try to triage but ask there
Here's my streams.py
class ContractsStream(myStream):
"""Define custom stream."""
name = "my_new_table"
primary_keys = ["contract_id", "datetime_downloaded_from_api", ]
replication_key = None
schema = th.PropertiesList(
th.Property("datetime_downloaded_from_api", th.DateTimeType),
th.Property("contract_id", th.IntegerType)
).to_dict()
emcp
09/09/2021, 8:29 PM"datetime_downloaded_from_api": "2021-09-09T20:24:10.901279+00:00"}, "time_extracted": "2021-09-09T20:25:26.000565Z"}
I guess I can try dropping my timestamp entirely and seeing if I can leverage this time_extracted insteademcp
09/09/2021, 8:30 PMemcp
09/09/2021, 9:36 PMtime_extracted
to be part of my primary key in the Stream definition???
class ContractsStream(myStream):
"""Define custom stream."""
name = "my_new_table"
primary_keys = ["contract_id", "time_extracted", ]
replication_key = None
schema = th.PropertiesList(
th.Property("datetime_downloaded_from_api", th.DateTimeType),
th.Property("contract_id", th.IntegerType)
).to_dict()
edward_ryan
09/09/2021, 9:41 PMtime_extracted
can be part of the primary keyemcp
09/10/2021, 10:01 AMtime_extracted
but backed off in hopes of getting my tap working again.. once I have it downloading into postfresql successfully I can try again.. in meantime I cracked a way forward manually modifying the input to adhere to the UTC with z format.. python by default does something else and I worried that was the cause of apache superset not being able to preview the table.. but alas I think superset still isn’t showing a preview even when I DO have it working in the tap.. I will go bug apache superset slack for more help on that front..emcp
09/10/2021, 10:33 AMtime_extracted
as a part of primary keyemcp
09/10/2021, 3:46 PMtime_extracted
is not an included column .. at least not using the current papermills target for postgresql.. maybe it's an option that can be enabled.. but for now I have manually set a column and looked to proceed further from there
here's the columns related to datetime that I saw... dunno if I want to put them in the primary key with these names which are a bit obscure