Giter Club home page Giter Club logo

atlan-python's People

Contributors

0xquark avatar abhishek-raghuraman avatar aryamanz29 avatar cmgrote avatar dependabot[bot] avatar ernestoloma avatar nishantmunjal7 avatar prateekrai-atlan avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

atlan-python's Issues

Getting error when using Range query

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)

Generating SDKs?

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 ๐Ÿ˜ƒ

pyatlan.client.atlan takes ~7 seconds to import

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?

AtlanClient.asset.find_connections_by_name method does not return 'NotFoundError' when connection does not exist

Describe the Bug

The find_connections_by_name method here returns an empty list instead of the NotFoundError as described in the doc string

Steps to reproduce

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

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.