atlanhq / atlan-python Goto Github PK
View Code? Open in Web Editor NEWPython SDK for Atlan
Home Page: https://developer.atlan.com/sdks/python/
License: Apache License 2.0
Python SDK for Atlan
Home Page: https://developer.atlan.com/sdks/python/
License: Apache License 2.0
When can we expect support for pydantic 2.x versions?
I'm getting the following error when trying to fetch Audit Logs from Atlan:
File "/home/luis_pedro_anchorlabs_com/anchorage/source/python/lib/atlan_lib/src/atlan_lib/audit/audit.py", line 18, in get_ui_audit_logs
search_results = self.client.audit.search(search_req)
File "/home/luis_pedro_anchorlabs_com/anchorage/source/python/lib/atlan_lib/.venv/lib/python3.9/site-packages/pydantic/v1/decorator.py", line 40, in wrapper_function
return vd.call(*args, **kwargs)
File "/home/luis_pedro_anchorlabs_com/anchorage/source/python/lib/atlan_lib/.venv/lib/python3.9/site-packages/pydantic/v1/decorator.py", line 134, in call
return self.execute(m)
File "/home/luis_pedro_anchorlabs_com/anchorage/source/python/lib/atlan_lib/.venv/lib/python3.9/site-packages/pydantic/v1/decorator.py", line 206, in execute
return self.raw_function(**d, **var_kwargs)
File "/home/luis_pedro_anchorlabs_com/anchorage/source/python/lib/atlan_lib/.venv/lib/python3.9/site-packages/pyatlan/client/audit.py", line 37, in search
raw_json = self._client._call_api(
File "/home/luis_pedro_anchorlabs_com/anchorage/source/python/lib/atlan_lib/.venv/lib/python3.9/site-packages/pyatlan/client/atlan.py", line 360, in _call_api
params = self._create_params(api, query_params, request_obj, exclude_unset)
File "/home/luis_pedro_anchorlabs_com/anchorage/source/python/lib/atlan_lib/.venv/lib/python3.9/site-packages/pyatlan/client/atlan.py", line 400, in _create_params
params["data"] = request_obj.json(
File "/home/luis_pedro_anchorlabs_com/anchorage/source/python/lib/atlan_lib/.venv/lib/python3.9/site-packages/pydantic/v1/main.py", line 504, in json
return self.__config__.json_dumps(data, default=encoder, **dumps_kwargs)
File "/usr/lib/python3.9/json/__init__.py", line 234, in dumps
return cls(
File "/usr/lib/python3.9/json/encoder.py", line 199, in encode
chunks = self.iterencode(o, _one_shot=True)
File "/usr/lib/python3.9/json/encoder.py", line 257, in iterencode
return _iterencode(o, 0)
File "/home/luis_pedro_anchorlabs_com/anchorage/source/python/lib/atlan_lib/.venv/lib/python3.9/site-packages/pydantic/v1/json.py", line 101, in custom_pydantic_encoder
return encoder(obj)
File "/home/luis_pedro_anchorlabs_com/anchorage/source/python/lib/atlan_lib/.venv/lib/python3.9/site-packages/pyatlan/model/audit.py", line 67, in <lambda>
json_encoders = {Query: lambda v: v.to_dict(), SortItem: lambda v: v.to_dict()}
File "/home/luis_pedro_anchorlabs_com/anchorage/source/python/lib/atlan_lib/.venv/lib/python3.9/site-packages/pyatlan/model/search.py", line 633, in to_dict
add_clause(name)
File "/home/luis_pedro_anchorlabs_com/anchorage/source/python/lib/atlan_lib/.venv/lib/python3.9/site-packages/pyatlan/model/search.py", line 630, in add_clause
clauses[name] = [c.to_dict() for c in clause]
File "/home/luis_pedro_anchorlabs_com/anchorage/source/python/lib/atlan_lib/.venv/lib/python3.9/site-packages/pyatlan/model/search.py", line 630, in <listcomp>
clauses[name] = [c.to_dict() for c in clause]
File "/home/luis_pedro_anchorlabs_com/anchorage/source/python/lib/atlan_lib/.venv/lib/python3.9/site-packages/pyatlan/model/search.py", line 893, in to_dict
value = get_value(name)
File "/home/luis_pedro_anchorlabs_com/anchorage/source/python/lib/atlan_lib/.venv/lib/python3.9/site-packages/pyatlan/model/search.py", line 877, in get_value
attribute_value = int(self.value.timestamp() * 1000)
AttributeError: 'Range' object has no attribute 'value'
pyatlan == 2.0.2
python == 3.9
It seems the error comes from:
packages/pyatlan/model/search.py", line 877, in get_value
attribute_value = int(self.value.timestamp() * 1000)
I believe that line should be:
attribute_value = int(attribute_value.timestamp() * 1000)
For reference:
~True == -2
and
~False == -1
Can we change this so it uses the not
operator?
Hi ๐
My name is Dylan and I am one of the founders of Konfig. We generate SDKs for API companies. I see that its a lot of work to handwrite SDKs for Atlan.
Would Atlan be interested in working with us to offload dev work and improve DevEx?
Happy to continue the conversation or jump on a call if there is any interest ๐
Running import pyatlan.client.atlan
takes around 7 seconds to complete. This takes far longer than I'd expect import statements to normally take (usually I'd expect it to take a small fraction of a second, and most libraries we use, such as Airflow, pandas, standard libaries, and more are all very fast to import).
Importing the atlan client actually takes much longer than instantiating it or making an Atlan API request which is very surprising.
Here's a piece of code that replicates this:
import time
t1 = time.time()
from pyatlan.client.atlan import AtlanClient
t2 = time.time()
print("atlan client import time (seconds):", t2 - t1)
t3 = time.time()
client = AtlanClient()
t4 = time.time()
print("atlan client instantiation time (seconds):", t4 - t3)
from pyatlan.model.assets import Table
t5 = time.time()
x = client.asset.get_by_guid(asset_type=Table, guid="d3c4d7a3-bec1-490c-9705-83059ffbf085")
t6 = time.time()
print("atlan client get table by guid time (seconds):", t6 - t5)
It outputs this on my machine:
atlan client import time (seconds): 7.337576866149902
atlan client instantiation time (seconds): 0.003535032272338867
atlan client get table by guid time (seconds): 1.0856139659881592
I'm on a macbook pro intel cpu.
I've seen a few issues around the web that are related and give some indication that its due to how pydantic is being used:
#187
pydantic/pydantic#6768
pydantic/pydantic#7263
Is this something that can be optimized/fixed?
The find_connections_by_name
method here returns an empty list instead of the NotFoundError
as described in the doc string
NOTE: This expects the variables atlan_base_url
and atlan_api_key
to be set, not included here
from pyatlan.client.atlan import AtlanClient
from pyatlan.errors import NotFoundError
from pyatlan.model.enums import AtlanConnectorType
# atlan_base_url = "myatlaninstance"
# atlan_api_key = "mykey"
atlan_client = AtlanClient(base_url=atlan_base_url, api_key=atlan_api_key)
try:
results = atlan_client.asset.find_connections("my_non_existent_connection",AtlanConnectorType.GCS)
print(len(results))
except NotFoundError:
print("Exception thrown, connection does not exist")
Instead of throwing the NotFoundError exception, it instead returns an empty list.
This could be expected behaviour if the doc string itself is wrong in the method
Hey, would it be possible to add an option to configure HTTP proxy for AtlanClient? It's useful in some usecases, but I see no way of doing so at this moment
We are using Atlan Python SDK to integrate with our platform, we have an issue with conflicting versions of Pydantic as we usually run the latest version, currently 2.7.1
. Can you change it from your requirements
to 2.x.x?
Line 2 in beea7e2
Thanks!
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.