Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pyatlan.client.atlan takes ~7 seconds to import #310

Open
zholbrook-plaid opened this issue May 1, 2024 · 3 comments
Open

pyatlan.client.atlan takes ~7 seconds to import #310

zholbrook-plaid opened this issue May 1, 2024 · 3 comments
Assignees
Labels
question Further information is requested

Comments

@zholbrook-plaid
Copy link

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?

@Aryamanz29
Copy link
Member

Hey @zholbrook-plaid, thank you for opening an issue!

Could you also share your installed pyatlan version with us, so that we can investigate further?

I've just double-checked with the snippet you provided, and here are the results:

(venv) ➜  ✗ pip show pyatlan
Name: pyatlan
Version: 2.1.7 (latest)
Summary: Atlan Python Client

atlan client import time (seconds): 3.320816993713379
atlan client instantiation time (seconds): 0.002034902572631836
atlan client get table by guid time (seconds): 0.479140043258667

I'm running this on a MacBook Pro M1 (16 GB RAM) ☝️

@Aryamanz29 Aryamanz29 added the question Further information is requested label May 3, 2024
@zholbrook-plaid
Copy link
Author

Hi @Aryamanz29 , I'm on pyatlan 2.1.6:

-> pip show pyatlan
Name: pyatlan
Version: 2.1.6
Summary: Atlan Python Client

@zholbrook-plaid
Copy link
Author

FYI: I've upgraded to pyatlan 2.1.7 and it has similar results:

atlan client import time (seconds): 6.82206916809082
atlan client instantiation time (seconds): 0.0039980411529541016
atlan client get table by guid time (seconds): 1.0934627056121826

@Aryamanz29 Aryamanz29 self-assigned this May 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants